Skip to content

Instantly share code, notes, and snippets.

Avatar

Valentin Deleplace Deleplace

View GitHub Profile
@Deleplace
Deleplace / mapfunc_test.go
Created Nov 17, 2022
Is there a performance penalty when taking a func argument instead of a value argument, in concurrent maps operations?
View mapfunc_test.go
package mapfunc
import (
"sync"
"testing"
"github.com/puzpuzpuz/xsync/v2"
)
const (
@Deleplace
Deleplace / gist:869094a77a5292b40511704482e3e7d8
Created Nov 9, 2022
URL for Google Images search, to be used in Chrome in Settings > Search engine > Add
View gist:869094a77a5292b40511704482e3e7d8
https://www.google.com/search?q=%s&tbm=isch
@Deleplace
Deleplace / stablesort_test.go
Last active Nov 7, 2022
Overhead of stable sorting, in Go
View stablesort_test.go
package stablesort
import (
"math/rand"
"sort"
"testing"
"golang.org/x/exp/slices"
)
@Deleplace
Deleplace / stablesort_test.go
Created Nov 7, 2022
How much overhead for a STABLE sort of 1000 lowercase letters (26 possible values per letter), compared to a standard sort?
View stablesort_test.go
package stablesort
import (
"math/rand"
"sort"
"testing"
)
const (
M = 500
View roses-are-red.txt
Roses are red
Violets are blue,
Sugar is sweet
And so are you.
View othello.txt
Othello, the Moore of Venice
ACT I
SCENE I. Venice. A street.
Enter RODERIGO and IAGO
RODERIGO
Tush! never tell me; I take it much unkindly
That thou, Iago, who hast had my purse
As if the strings were thine, shouldst know of this.
IAGO
View hamlet.txt
The Tragedy of Hamlet, Prince of Denmark
ACT I
SCENE I. Elsinore. A platform before the castle.
FRANCISCO at his post. Enter to him BERNARDO
BERNARDO
Who's there?
FRANCISCO
Nay, answer me: stand, and unfold yourself.
BERNARDO
@Deleplace
Deleplace / set_implementations.go
Last active Sep 9, 2022
Comparison of memory footprint of map[int]bool vs. map[int]struct{}
View set_implementations.go
package main
import (
"fmt"
"math/rand"
"runtime"
)
func main() {
BoolImplMemoryFootprint()
@Deleplace
Deleplace / insert_test.go
Created Sep 8, 2022
Benchmark heavy use of slices.Insert vs. heavy use of a dynamic-array-like insert func
View insert_test.go
package insert
import (
"fmt"
"testing"
"golang.org/x/exp/slices"
)
func BenchmarkGrow(b *testing.B) {