Skip to content

Commit

Permalink
Optimize MapX.Assign and MapX.NewWith (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlange-42 authored Dec 26, 2024
1 parent 128b0c1 commit 837c3c3
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 200 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@

## [[unpublished]](https://github.com/mlange-42/arche/compare/v0.14.1...main)

### Performance

* Optimize `MapX.Assign` and `MapX.NewWith` by use of `World.GetUnchecked` (#449)

### Documentation

* Fix method names and ordering in benchmark tables (448)
* Fix method names and ordering in benchmark tables (#448)

## [[v0.14.1]](https://github.com/mlange-42/arche/compare/v0.14.0...v0.14.1)

Expand Down
6 changes: 5 additions & 1 deletion generic/_generate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ func generateMaps() {
returnAllSafe += ",\n"
arguments += ", "
}
assign += fmt.Sprintf("*(*%s)(m.world.Get(entity, m.id%d)) = *%s\n", typeLetters[j], j, strings.ToLower(typeLetters[j]))
if j == 0 {
assign += fmt.Sprintf("*(*%s)(m.world.Get(entity, m.id%d)) = *%s\n", typeLetters[j], j, strings.ToLower(typeLetters[j]))
} else {
assign += fmt.Sprintf("*(*%s)(m.world.GetUnchecked(entity, m.id%d)) = *%s\n", typeLetters[j], j, strings.ToLower(typeLetters[j]))
}
}

data := query{
Expand Down
Loading

0 comments on commit 837c3c3

Please sign in to comment.