mamift/CSharpTest.Net.Collections

Populating BPlusTree is considerably slower on Linux

p-m-j opened this issue · 1 comments

p-m-j commented

To demonstrate I have created a small application which inserts a few paragraphs of lorem ipsum repeatedly into a BPlusTree<int,string> which can be found here https://gist.github.com/p-m-j/606a27877c26725b6058442f39a8fb64

Example output from my PC

Windows

Wrote 5000 entries to C:\Users\Paul Johnson\AppData\Local\Temp\tmp8DF0.tmp in 8.4379227

Linux

Wrote 5000 entries to /tmp/tmpd6FNXg.tmp in 95.3526502

@p-m-j I looked at this a bit and found that is you don't use the /tmp/ folder in Linux you'll get much better results.

In my fork I've updated the test projects to see if they gave any clue to the mysterious behavior but I couldn't find anything there. I've also added a benchmark/test project CSharpText.Net.Benchmark where I've tested a bit if you'd like to validate the results 😄

My fork: https://github.com/nikcio/CSharpTest.Net.Collections

Using your gist example I found that when running the performance profiler in VS studio the Filename in the options matter.

On Linux using(Path.GetTempFileName) took: 1:24 min

image

On Linux using(Path.Combine(Environment.CurrentDirectory, "tmpfile.tmp") took: 20.642 seconds

image

On Windows using(Path.GetTempFileName) took: 11.728 seconds

image

On Windows using(Path.Combine(Environment.CurrentDirectory, "tmpfile.tmp") took: 9.814 seconds

image

The files here are from the results I've gathered: nikcio@de9425f

Maybe changing the path of the file will be an easy workaround to start with.

Note: This project could really need a hand. When I multitargeted the tests I found that a bunch of them fail in newer dotnet version