Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Truncation of ephemerides now also limit the memory footprint
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherRabotin committed Apr 19, 2017
1 parent 7a34f08 commit bec09f9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ func (c _smdconfig) HelioState(planet string, epoch time.Time) planetstate {
if err != nil {
panic("could not parse date time")
}
// Check if the truncated date time already exists in the map, and if so skip (so we have store the values which is the closest the time change).
// This also allows for a much smaller memory footprint when loading ephemerides with a large truncation step
// (e.g. loading 1h instead of 1m requires less than 60 as much memory (less because of the hashing)).
dt = dt.Truncate(conf.spiceTrunc)
if _, exists := loadedCSVdata[ephemeride][dt]; exists {
continue
}
// Drop the string of the date
R := make([]float64, 3)
V := make([]float64, 3)
Expand Down

0 comments on commit bec09f9

Please sign in to comment.