Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idiomatic Bubble Sort Performance #3

Open
chrisVillanueva opened this issue Dec 2, 2017 · 1 comment
Open

Idiomatic Bubble Sort Performance #3

chrisVillanueva opened this issue Dec 2, 2017 · 1 comment

Comments

@chrisVillanueva
Copy link

@basarat: I created arrays of 10K and 50K random integers. I sorted the same array in nodejs using both bubble sort examples. The idiomatic example performs slower that the basic sort example. Is that expected?

##############################################
#                                            #
           ***** bubble sort *****
#                                            #
##############################################
bubbleSortProcessing-[10000]: 4758.006ms
earlyTerminationBubbleSortProcessing-[10000]: 4994.364ms

[nodemon] clean exit - waiting for changes before restart
[nodemon] restarting due to changes...
[nodemon] starting `node ./index.js`

##############################################
#                                            #
           ***** bubble sort *****
#                                            #
##############################################
bubbleSortProcessing-[50000]: 119734.447ms
earlyTerminationBubbleSortProcessing-[50000]: 125780.788ms

[nodemon] clean exit - waiting for changes before restart
 

I did notice a performance gain with Idiomatic sort using smaller data sets.

##############################################
#                                            #
           ***** bubble sort *****
#                                            #
##############################################
bubbleSortProcessing-[500]: 16.692ms
earlyTerminationBubbleSortProcessing-[500]: 12.605ms
[nodemon] clean exit - waiting for changes before restart

@basarat
Copy link
Owner

basarat commented Sep 9, 2020

No not expected. I don't know why it's happening. If you can share your code I can have a look.

Sorry I missed this message somehow 🌹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants