Btw, it seems like you could have :

type T [8]int32

and define L:= [100000]T{} and T would just be a permutation of 8 integers
between 0 and 100,000.

Maybe your example is a bit too contrived or I am mistaken.
On Sunday, October 26, 2014 8:48:07 PM UTC, nicolas...@gmail.com wrote:

I must create a lot of objects.
My concern is to ease the work of the garbage collector, to avoid frequent
and long pauses.

What is your opinion about the following sentences ?

- Instead of creating 100'000 objects of type T separately, is it better
to create one big array of 100'000 elements [100000]T ?

- Each of these objects contains 8 pointers *T to other objects. Is it
better to replace these pointers *T by indices (int) into the array of
objects ?

- The frequency of the GC is proportional to the garbage creation rate ?

- The GC duration is proportional to the total number of pointers used in
all live objects (mark phase), and the number of objects to free (sweep
phase) ?

- Each time a pointer is updated by the Go code, is it true that the
garbage collector must do some processing ?

- What is the most important, finally:
- avoid creating garbage ?
- avoid creating too many objects ?
- avoid creating too many pointers ?
- avoid code that update pointers with high frequency ?
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 13 | next ›
Discussion Overview
groupgolang-nuts @
postedOct 26, '14 at 8:48p
activeOct 27, '14 at 1:27p



site design / logo © 2021 Grokbase