Thursday, March 23, 2023
HomeGolangCode quicken: runtime.mapaccessX _ faststr - Obtaining Aid

Code quicken: runtime.mapaccessX _ faststr – Obtaining Aid

I am self idea golang individual, or else mechanical designer (up until now from a programs specialist). I switched over from python to golang to quicken my job code as it can compete days, so any kind of quicken is truly valued, particularly as I make use of the code for evaluations on everyday basis.

I have actually been running consistently pprof profiling and also enhanced use collections any place feasible or changed it with very own code. Until now I am rather pleased, obtained the quicken wrt python for 82x, which is remarkable. I think my code is rather enhanced as pprof device reveals that my features are not on top any longer. Currently, concerning 56% of the moment is made use of by the features runtime.mapaccess1 _ faststr and also runtime.mapaccess2 _ faststr, which as suggests is accessing specifications in my map[string] map[string] * SomeParams Exists anyhow to boost or workaround this component or have I strike basically all-time low? Thanks kindly for any kind of professional point of view or a tip on this component.

Hi, @Rok_Petka, welcome back to the discussion forum!

Are the string tricks to these maps a well-known collection (that is, exist, for instance, 8 feasible type in either the external or internal map( s))? Perhaps you could make use of a struct rather?

Can you combine with each other the tricks, so rather than map[string] map[string] * SomeParams, where you alter your gain access to the worths from m["key1"]["key2"] to m[[2] string {"key1", "key2}] map[[2] string] * SomeParams? That must make it a solitary map gain access to rather than 2. However it’s still hashing/comparing 2 strings, so it could not in fact aid.

To provide any kind of various other concepts, I would certainly need to see the code to see what you’re making with the map, especially.

Hi @skillian, thanks for your e-mail and also responses, valued.

Your inquiries are all pertaining to the code, normally, so I’ll provide a glance on it as the code remains in total +30 k lines.

map[string] map[string] * SomeParams

As a whole, the code is extremely basic, the very first tricks of the map are merely days, and also the 2nd tricks are a system parts, its procedure controllers and so on and afterwards * SomeParams are components/controllers associated specifications, dimension worths and so on. As An Example:

day["2022-09-01"]["Turbine1"] EnergyFlow = SomeEquation
day["2022-09-01"]["Turbine1"] Temperature1 = MeasuredValue

So, the very first tricks ( days) remain in size of hundreds (can be thousands), the 2nd tricks ( components/controllers) in thousands and also * SomeParams in hundreds too. * SomeParams are a lot of the moment design formulas like warm and also mass equilibrium, Fourier-analysis specifications, and so on. This is primarily entire ideology, which winds up on a significant variety of map calls. Any type of concepts on renovation or practical restructuring?

Thanks quite.

PS: Thanks for the pointer: m[[2] string {"key1", "key2}] map[[2] string] * SomeParams though in this situation am uncertain if this would certainly be okay from the quality of code stand factor, maybe speed up also as stated.

This subject was immediately shut 90 days after the last reply. New replies are no more permitted.


Most Popular

Recent Comments