[go-nuts] Re: get_tls macro and friends

2018-01-29 Thread Damian Gryski
Other examples I found in the runtime seem to refer to "go_tls.h".  My 
guess is the /doc/asm page is out of date.

Damian

On Wednesday, January 24, 2018 at 7:26:18 PM UTC-8, Caleb Spare wrote:
>
> Quick question about the Go assembler. 
>
> I'm trying to use the get_tls and related macros mentioned near the 
> bottom of https://golang.org/doc/asm. 
>
> Although the line 
>
> # include "go_asm.h" 
>
> doesn't give an error, subsequent lines where I use the macro fail: 
>
> get_tls(CX) // unrecognized instruction "get_tls" 
>
> The go_asm.h header seems to be generated by the toolchain rather than 
> being a file I can take a look at. Does anyone know more about how it 
> works? Is it only available to runtime code (though that's not 
> mentioned on https://golang.org/doc/asm)? 
>
> Thanks! 
> Caleb 
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Go2 proposal: remove := operator (or remove variable shadowing)

2018-10-29 Thread Damian Gryski


On Monday, October 29, 2018 at 5:05:40 AM UTC-7, Sokolov Yura wrote:
>
> Yes, err handling is a part of variable shadowing mistakes. But it is not 
> all such mistakes.
> I shadowed other variables at least as often as errors.
>

While shadowing is sometimes an issue, warning every times it happens 
generates too much noise.

I like `ineffassign` that finds most issues caused by shadowed variables, 
with a very low false-positive rate.

https://github.com/gordonklaus/ineffassign


Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: top N values

2018-11-06 Thread Damian Gryski


On Tuesday, November 6, 2018 at 12:17:09 PM UTC-8, Josep Casado Pérez wrote:
>
> Please, check this post answer [https://stackoverflow.com/a/7272702]. Try 
> to use quickselect and then iterate your slice.


I have an implementation of QuickSelect that works with any 
sort.Interface: https://github.com/dgryski/go-qselect

(Side note: If you're looking for more things to do in the comparison model 
provided by Swap/Less/Len, https://github.com/dgryski/go-stablepart )

Damian 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: [RFC] Dynamically instrumentation Go binaries

2018-11-15 Thread Damian Gryski
One approach would be to augment the compiler to instrument the binary with 
the techniques outlined in:

XRay: A Function Call Tracing System
https://ai.google/research/pubs/pub45287

Damian

On Thursday, November 15, 2018 at 9:09:19 AM UTC-8, ju...@sqreen.io wrote:
>
> Hi,
>
> I am working on dynamic instrumentation of Go programs at run time, 
> possibly without static source-code instrumentation. As I would like a 
> solution as close to Go and standard as possible, I was first thinking of 
> using `go generate` to generate a file adding things `reflect` doesn't 
> provide such as the list of packages, functions, global variables... That 
> way, I should be able to use `reflect` to modify any dynamic calls by 
> modifying the method tables of their underlying type representations.
>
> But regarding statically linked calls, the less intrusive technique I 
> found are uprobes, which is linux-specific. And at the opposite, there are 
> user-space binary code instrumentation libraries such as dyninst that 
> modify the code at run time...
>
> So I am wondering if anyone here has any thoughts on this subject, that 
> doesn't seem to be solved for Go programs.
>
> Thanks!
>
> Julio
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] A Measure of Hash Function Collisions

2019-02-12 Thread Damian Gryski
For more information on hash function goodness tests, check 
out https://github.com/demerphq/smhasher

Damian

On Tuesday, February 12, 2019 at 5:23:39 AM UTC-8, Serhat Şevki Dinçer 
wrote:
>
> On Saturday, February 9, 2019 at 5:23:14 PM UTC+3, Serhat Şevki Dinçer 
> wrote:
>>
>> On Fri, Feb 8, 2019 at 7:42 PM Michael Jones wrote: 
>> > clustering: 
>> > https://www.cs.cornell.edu/courses/cs3110/2014fa/lectures/13/lec13.html 
>> > 
>> > careful hash functions often treat short inputs specially. 
>> > 
>> > iterated shift-xor alone is weak in expanding the "changed bits(s)" 
>> signal, at least by comparison to a) large prime multiply, b) good s-boxes, 
>> c) introduction of keyed material. 
>> Hm, thanks. I would like to try a particular version of this prime 
>> multiplication idea wih utf8 strings. 
>> I wrote for loops to find collisions (attached). It takes 3 seconds 
>> and finds no collision for strings with length < 4. 
>> The next step (including length=4, commented in the code) will take 
>> 13+ min and 32+ gb ram, so I appreciate if anyone with sufficient RAM 
>> could try that and report the result ;P 
>> Thanks.. 
>>
>
> I got access to a server with 64 gb ram. On it, using a Go map did not 
> work, so I used a list and sorted it for identifying collisions.
> It turned out both prime and shift versions (attached) of the simple hash 
> turned out to be really good for small inputs. No collisions for 
> 7_918_845_952 inputs.
> This required 59 GiB of ram. For a 64-bit cryptographic hash output, the 
> probability of a collision for that many inputs is about %82.
>
> What I am curious about next is
> - How further can this test be taken ? When are the first collisions for 
> these simple hashes with the given code ?
> - What are their "minimum sum of colliding inputs lengths" ?
> - Is there a (smooth) trade-off between being cryptographic / 
> good-bit-mixing *and* being nice on small inputs / high minimum sum of 
> colliding inputs lengths ? Assume that we dont treat small inputs 
> differently, and there is one general algorithm for all inputs..
> - Can a cryptographic hash function have high minimum sum of colliding 
> inputs lengths, or be nice on small inputs ?
>
> Thanks..
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Is it practical to auto rearrange struct fields to reduce paddings in Go?

2019-02-12 Thread Damian Gryski

Check out https://github.com/dominikh/go-tools/tree/master/cmd/structlayout 
and https://github.com/dominikh/go-tools/tree/master/cmd/structlayout-optimize


On Wednesday, February 6, 2019 at 8:20:06 PM UTC-8, Kurtis Rader wrote:
>
> > Is it practical to auto rearrange struct fields to reduce paddings in Go?
>
> Auto rearrange? Probably not. Manual rearrange? Maybe, if the struct isn't 
> part of a public API. If the struct is part of a private API removing the 
> padding could be counterproductive or harmful to performance if the layout 
> is intended to minimize false cache sharing between CPUs. Obviously whether 
> or not padding will be present also depends on the machine architecture. So 
> the author may intend for that padding (or lack thereof) because it 
> maximizes performance or some other metric on their platform.
>
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] efficient random float32 number generator?

2019-03-05 Thread Damian Gryski


On Monday, February 25, 2019 at 2:39:02 PM UTC-8, DrGo wrote:
>
> Thanks Ian, 
> The std lib float32 is slow for my purpose. In my benchmarking it is 
> actually slower than the float64. But I don’t even need float16 precision. 
> I am working on implementing othe alias method for sampling from a fixed 
> freq dist with possibly thousands of arbitrary values. So the rng doesn’t 
> need to be precise or high quality because of rounding eg a rn of .67895 
> might end up selecting the same arbitrary value as .67091 or even .65!! 
> https://en.m.wikipedia.org/wiki/Alias_method 
>

Also, https://github.com/dgryski/go-discreterand 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Proposal: Add coloured output to go commands

2016-07-13 Thread Damian Gryski


On Tuesday, July 12, 2016 at 11:26:57 PM UTC-6, Ian Lance Taylor wrote:
>
> On Tue, Jul 12, 2016 at 9:36 PM, Zac Pullar-Strecker  > wrote: 
> > Commands like go run, go build and go test amoung others should have 
> > coloured output when an error occurs. it would make reading stack traces 
> a 
> > lot easier. I personally use the go run tool a lot during development 
> > because I have no reason to keep a binary in the $GOPATH/bin directory 
> when 
> > it's likely to change in the next 5 minutes. 
> > 
> > github.com/fatih/color & github.com/kortschak/ct are os agnostic (Unix 
> & 
> > Windows,) packages for ANSI escape codes. 
> > It would make sense to do this with a flag -c or -color and anyone who 
> > wanted it perminantly could alias it. 
> > I'm relatively new to the community so I wanted to post it here before 
> > creating an issue on github. Are there any issues with doing this? 
>
> I think this is unlikely to be accepted. 
>
> Much more plausible would be a go-gettable colorizing filter that you 
> can apply to the go tool output.  Then you could run a shell script 
> that pipes go through that filter. 
>
>
An example of one that does this for gcc 
is https://github.com/colorgcc/colorgcc

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: goimports has been updated

2016-07-15 Thread Damian Gryski
Leaving blank lines in the imports section allows grouping: 
https://github.com/golang/go/wiki/CodeReviewComments#imports

Damian 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Regexp question

2016-08-16 Thread Damian Gryski


On Tuesday, August 16, 2016 at 1:00:15 PM UTC+2, Jan Mercl wrote:
>
> This code (A)
>
> package main
> 
> import (
> "fmt"
> "regexp"
> )
> 
> func main() {
> fmt.Printf("%v", 
> regexp.MustCompile(`a*`).FindAllStringIndex(`baaab`, -1))
> }
>
> (https://play.golang.org/p/WeyStT0Gbn)
>
> Produces
>
> [[0 0] [1 4] [5 5]]
>
> Why there is no match at [4 4]? That's at the (start of the) second letter 
> b in the text, analogically to the first match [0, 0]. Am I missing 
> something or is it a bug?
>


Seems like these sentences from the regexps docs match your case:

"If 'All' is present, the routine matches successive non-overlapping 
matches of the entire expression. Empty matches abutting a preceding match 
are ignored. "


The match at [4 4] would be an empty match abutting a preceding match.

Damian

>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: Stalking people online for thought crimes! This is what the Go project has succumbed to!

2016-11-04 Thread Damian Gryski


On Friday, November 4, 2016 at 8:22:49 PM UTC+1, prade...@gmail.com wrote:
>
> All I see here is nothing is done to moderate /r/golang despite threads 
> being reported for harassment. What good is a code of conduct if it isn't 
> enforced ? and when enforced , moderators have to come here to apologize 
> for doing their jobs, like Sarah ? If you don't want me to bring /r/golang 
> here, then do something about /r/golang because what is happening there is 
> an embarrassment to the go community.
>


As a recent moderator for /r/golang, I want to apologize for not strongly 
enforcing the CoC.  I continued to view myself as only a content provider. 
My lack of action is due to not wanting to be the center of attention for 
removing posts and being targetted by trolls. I see now that at least twice 
recently my inaction has lead to harmful threads and for that I'm sorry. 
 I've reached out to the /r/rust moderators for advice on how to handle 
moderating a technical subreddit, and have gotten some good advice.

In the past, moderation on /r/golang been lenient to non-existent.

I will begin moderating /r/golang under the CoC and taking more actions on 
CoC violations.  Russ Cox and I are looking for people who have the time 
and desire to help while we make this transition.

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Avoiding function call overhead in packages with go+asm implementations

2016-11-18 Thread Damian Gryski
This is one of those tricks that should be in a "best practices for writing asm 
with Go" document.

Maybe we should start one on the wiki? Including things like "common build tags 
for disabling asm" and the like.

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: interesting potential go event talk

2017-06-13 Thread Damian Gryski
Just went to add this to https://github.com/golang/go/wiki/ResearchPapers , 
but it's already there :)

Damian

On Sunday, June 11, 2017 at 5:44:33 PM UTC+2, Michael Jones wrote:
>
> Atom: Horizontally Scaling Strong Anonymity
>
> "To evaluate Atom, *we implemented an Atom prototype*
> *in Go*, and tested it on a network of 1,024 Amazon EC2
> machines. Our result shows that Atom can support more
> than one million users sending microblogging messages with
> 28 minutes of latency. using 1,024 commodity machines.
> (Processing this number of messages using Riposte [21], a
> centralized anonymous microblogging system, would take
> more than 11 hours.) Atom can also support a million users
> dialing with 28 minutes of latency, with stronger guarantees
> than prior systems [47, 68]."
>
> https://arxiv.org/pdf/1612.07841.pdf
>
> -- 
> Michael T. Jones
> michae...@gmail.com 
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: [ANN] go-dedup/simhash, enhanced Go simhash package

2017-07-04 Thread Damian Gryski


On Monday, July 3, 2017 at 6:33:05 PM UTC+2, Tong Sun wrote:
>
> FYI, I've just enhanced the Go simhash package from mfonda/simhash 
>  to go-dedup 
> /simhash 
> . 
>
> The reasons & enhancements are summaries here:
> https://github.com/go-dedup/simhash#versions
>
> Detailed documents of such changes, and the reasons behind it, also how to 
> use the original (v1) design API can be found here 
> .
>
> All patches welcome! Thx. 
>
>

   - dgryski/go-simstore  One of 
   the earliest but "*not very promising*" 
   
:(


Note that the package that was listed as "not very promising" was the 
initial "trifles" implementation, and not the complete service that's in 
go-simstore.

It's hard-coded for distance 3 or 6 and I've done a bunch of work on it in 
terms of memory reduction.  The service is used in production at 
Booking.com on data sets of ~60 million records.

Damian
 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: [ANN] go-dedup/simhash, enhanced Go simhash package

2017-07-05 Thread Damian Gryski


On Tuesday, July 4, 2017 at 10:56:35 PM UTC+2, Tong Sun wrote:
>
> Good to know. 
>
> One question, I didn't find any help/text on how to use it -- why for so 
> many years, there is no usage help? My guess was that it is mainly for 
> internal use, not for the general public, but maybe I was wrong. 
>
>
>
A little bit of both.  It was initially developed on my own time out of 
pure interest.  Then a month or so later it turned out we needed it at 
work, so I did a bunch more work on it and then various performance 
improvements both as needed for work for my own interest.  For example, the 
compressed table support was initially for my own interest, but then as our 
data set grew we enabled it.

I agree there is virtually no documentation for it :(  I do know however 
that a few other people are actually running it.  I'm in the middle of an 
international move right now (Amsterdam -> Vancouver), but I'll try to find 
some time to write some documentation for it.

Damian


 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Announcing gophersat, a SAT and Pseudo-Boolean solver, v1.0.0

2017-12-21 Thread Damian Gryski
How does it compare to https://github.com/IRIFrance/gini ?

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Announcing gophersat, a SAT and Pseudo-Boolean solver, v1.0.0

2017-12-21 Thread Damian Gryski
Wow, thanks for the detailed answers!

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Is go1.10beta1 a debug or unoptimized build? (possible regression)

2017-12-24 Thread Damian Gryski
I've also seen benchmarks / load testing on my Mac with lots of time in 
time.now, according to pprof. We were calling time.Now frequently, but it seems 
this added code might exacerbate the issue.

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Go Community Charity Work?

2017-12-24 Thread Damian Gryski
In cryptographic terms, this would be a "replay attack", although I'm not sure 
how any of the standard mitigations would apply in the resl world, especially 
if the verification is to be done offline.

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] December Blog Post Series

2016-12-02 Thread Damian Gryski
And my first post on writing assembly functions with PeachPy is up now: 
https://blog.gopheracademy.com/advent-2016/peachpy/

This is a quick introduction to a tool I've been using in some of my 
performance work recently. My favourite result so far is speeding up my 
HighwayHash implementation 10x via SSE instructions. Most of my improvements 
are closer to 2x.

Hope you enjoy it!  We have a great lineup this year. I'm really looking 
forward to reading them.

If you want to help with editing, you can watch for the Pull Requests against 
https://github.com/gopheracademy/gopheracademy-web and join the #writing 
channel on the Gophers slack.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: invitation to gophers.slack.com

2016-12-13 Thread Damian Gryski


On Friday, December 9, 2016 at 4:16:45 PM UTC+1, Ian Davis wrote:
>
> As an aside, does anyone know if there are publicly available chatlogs 
> from the slack channel?
>
>
There are not.  You must be a member of the Gophers Slack to see the 
message achive.

Damian 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] How to speed up execution time for a set of regular expressions

2016-12-15 Thread Damian Gryski
I wrote a quick tutorial on using ragel to speed up matching regular 
expressions in Go.

https://medium.com/@dgryski/speeding-up-regexp-matching-with-ragel-4727f1c16027

I had planned on writing a few more I n using some of ragels other features for 
matching things.

I have an example of a ragel-based lexer in https://github.com/dgryski/dpc

Hope this helps,

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Upgraded to Go 1.8beta2 and now Atom go-plus isn't working

2016-12-16 Thread Damian Gryski


On Friday, December 16, 2016 at 4:36:24 PM UTC+1, kcr...@sessionm.com wrote:
>
> I've had some luck across golang version changes by recompiling 
> github.com/nsf/gocode, which I believe go-plus uses for autocompletion.
>

Also https://github.com/mdempsky/gocode which is a cleaned up version using 
the new go/* packages for improved compatiblity/stability.

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Hashing (u)int8

2016-12-16 Thread Damian Gryski
The runtime has optimized map implementations for strings, int32 and 
int64-sized thing

There is no optimized implementation for int8-sized things -- just use an array.

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Hashing (u)int8

2016-12-17 Thread Damian Gryski
This ends up being only half a megabyte of memory (65536 x 8 byte pointers) for 
the array-based solution.

You can always write your own hash table, or convert your uint16 key to a 
uint32 for lookup purposes.  (I've done the same thing with floats to speed up 
a float64-keyed hash table.)

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-07 Thread Damian Gryski
I've seen this sort of question on the mailong list before. Probably a good 
idea to gather potential solutions on the Wiki somewhere.

Damian 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: bit twiddling API survey

2017-01-11 Thread Damian Gryski


On Wednesday, January 11, 2017 at 12:38:35 AM UTC+1, not...@google.com 
wrote:
>
> Are bit rotations complied to single instructions?  Specifically things 
> like:
>
> var a uint32
> (a << 5) | (a >> (32 - 5)
>

They will be (with 1.9) for constant rotate values: 
https://github.com/golang/go/issues/18254

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: Help translate x86-64 assenbly to Go assembly

2017-01-18 Thread Damian Gryski


On Tuesday, January 17, 2017 at 12:01:43 PM UTC+1, la...@namsral.com wrote:
>
> Thanks, Damian Gryski has a nice tutorial on how to write Go assembly 
> functions with PeachPy.
>
> https://blog.gopheracademy.com/advent-2016/peachpy/
>


Thanks!  I've written a bunch more assembly code using PeachPy -- mostly 
hash functions and a few crypto algorithms.  In general I'm getting a 2-3x 
speedup, but 10x in the case of Highway Hash (which can take advantage of 
SSE to process multiple blocks in parallel).

Let me know if you have any questions,

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Panic in go1.8rc3 using cgo to get binary data from database

2017-02-12 Thread Damian Gryski
Please file an issue at https://golang.org/issues

Damian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: When appending to arrays, gmp.Int values change for large number arrays

2017-05-14 Thread Damian Gryski


On Sunday, May 14, 2017 at 4:01:26 AM UTC+2, Elise Xue wrote:
>
> We're using gmp (library found at https://github.com/ncw/gmp) to run on 
> large inputs, and we have arrays with thousands of elements at a time in 
> our code. When we write these arrays to files, we find that the values of 
> some of the elements have changed.
>
>
> We tested our by code by reading in an input file of large numbers, 
> casting them to gmp.Int, storing them in an array, and writing them to an 
> output file. This works for an array of ~1400 numbers, but if the array 
> gets any larger than that the values in the array change.
>
> Below we print the first element of our array each time a new element gets 
> appended. As the size goes past 1435, the value of the first value changes, 
> and it changes again when the size goes past 1437:
>
>
>
Can you provide example code that demonstrates the issue?

Damian 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.