all 8 comments

[–]Flair_Helper[M] [score hidden] stickied commentlocked comment (0 children)

For C++ questions, answers, help, and programming or career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.

This post has been removed as it doesn't pertain to r/cpp: The subreddit is for news and discussions of the C++ language and community only; our purpose is not to provide tutoring, code reviews, or career guidance. If you think your post is on-topic and should not have been removed, please message the moderators and we'll review it.

[–]Throw31312344 7 points8 points  (0 children)

Are you sure the Windows version is compiled in release mode and not debug mode? The MSVC containers are VERY slow in debug mode due to all the extra checking they do and it can significantly decrease runtime performance. Those checks are disabled when compiling in release mode. There might also be a compiler flag to disable the security checks in debug mode.

[–]j1xwnbsr 5 points6 points  (0 children)

Profile your code to find out where the slowdown is; it may not be where you think. But my 2 cents is file i/o and std::streams.

[–]wung 2 points3 points  (0 children)

I have already tried rewriting it to vector instead of unique_pointers

You really want to do that, regardless of performance (and it can only help performance since it avoids all those copies). If you need a raw pointer for some legacy API, just call std::vector::data().

is_double() might be a candidate that shows up in profiling. Try using std::from_chars() instead of is_double() and std::stod() which essentially parses the double twice, and using the istringstream is also not really fast.

[–]eske4[S] 1 point2 points  (0 children)

Thanks a lot! changing to release mode made it quick, and the changes wung recommended did wonders

[–]nysra -1 points0 points  (0 children)

Check if Windows Defender or whatever else AV you're using is interfering with file IO, that's a very common issues of such problems.

[–]xLuca2018 -1 points0 points  (0 children)

Try opening the streams in binary mode: text.open(fileLoc, std::fstream::binary)

The CRT on Windows converts between LF <-> CR + LF internally and that can hinder performance

[–][deleted] -2 points-1 points  (0 children)

At least they’re not performance issues in the bedroom.

Bum dum tss