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

Optimize Diff creation #12

Merged
merged 6 commits into from
Jul 31, 2024
Merged

Optimize Diff creation #12

merged 6 commits into from
Jul 31, 2024

Conversation

badetitou
Copy link
Member

@badetitou badetitou commented Jul 29, 2024

By commits

  1. I created tests for GLPHEDiffRange>>#newFrom. And optimize this method a bit. I basically killed one string duplication
  2. same for GLPHEChange. My bench show two times faster

@badetitou badetitou changed the title add tests for GLPHEDiffRange newFrom: Optimize Diff creation Jul 29, 2024
@badetitou badetitou requested a review from alkalinan July 29, 2024 15:02
@badetitou
Copy link
Member Author

The last commit try to intriduce an optimization of the addAll:unless: method.
Here is the script I used to benchmark the update

users := OrderedCollection new.
1 to: 300 do: [ :idx |
	| user |
	user := GLHUser new.
	user id: idx. 
	users add: user ].

[	user2b := GLHUser new.
	user2b id: 298.
	user3b := GLHUser new.
	user3b id: 300.
	user4 := GLHUser new.
	user4 id: 302.

	result := users
		          addAll: {
				          user2b.
				          user3b.
				          user4 }
		          unless: [ :a :b | a id = b id ]] bench
"Before"
"'14 437.625 per second'"
"'16 029.394 per second'"
"After"
"'48 639.688 per second'"
"'44 872.426 per second'"

@alkalinan
Copy link
Collaborator

alkalinan commented Jul 31, 2024

I am nicolas and I approve these commits !

@guillep
Copy link

guillep commented Jul 31, 2024

Hi Nicolas! :)

@badetitou
Copy link
Member Author

Hi Nicolas :)

Copy link
Collaborator

@alkalinan alkalinan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve this commit !

@badetitou badetitou merged commit b8e5581 into main Jul 31, 2024
2 checks passed
@guillep guillep deleted the optimize-creating-of-diff branch July 31, 2024 08:07
@NicolasAnquetil
Copy link
Contributor

I am nicolas and I approve this message ;-)

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

Successfully merging this pull request may close these issues.

4 participants