[go-nuts] Re: OpenGL Fonts

2017-04-20 Thread Egon
On Friday, 21 April 2017 02:21:55 UTC+3, saif wrote: > > image atlas will assume that all needed fonts will fit in "image.NewRGBA > (image.Rect(0, 0, 1024, 1024))", right? > Not really, there are two fixes when you fill up the image: 1. Create an new atlas for new glyphs (switching during renderi

[go-nuts] [ANN] sqlite

2017-04-20 Thread Jérôme LAFORGE
Hello, It is driver only or that contains also the process that manages the data via sql? Thx in advance. -- 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 gola

Re: [go-nuts] Why sort.IsSorted implemented with decrement?

2017-04-20 Thread Ivan Kurnosov
Speaking low level - how about memory prefetch algorithms (os, hardware)? Do they work equally good when one iterates backward? On Friday, April 21, 2017 at 3:50:39 PM UTC+12, andrey mirtchovski wrote: > > > 297 for i := n - 1; i > 0; i-- { > > "i > 0" is cheaper than "i < n" on some processors

Re: [go-nuts] Why sort.IsSorted implemented with decrement?

2017-04-20 Thread andrey mirtchovski
> 297 for i := n - 1; i > 0; i-- { "i > 0" is cheaper than "i < n" on some processors :) On Thu, Apr 20, 2017 at 3:14 AM, wrote: > Hi > > At the moment it is implemented as > >295func IsSorted(data Interface) bool { >296n := data.Len() >297fo

[go-nuts] doubt about sync.NewCond

2017-04-20 Thread Allan
I run a demo program to learn sync.NewCond: package main import ( "fmt" "sync" "time" ) var locker = new(sync.Mutex) var cond = sync.NewCond(locker) func test(x int) { cond.L.Lock() cond.Wait() fmt.Println(x) time.Sleep(time.Second * 1) cond.L.Unlock() } func main(

Re: [go-nuts] Why sort.IsSorted implemented with decrement?

2017-04-20 Thread Ivan Kurnosov
@Rob, honestly to me they look the same: func IsSorted(data Interface) bool { n := data.Len() for i := n - 1; i > 0; i-- { if data.Less(i, i-1) { return false } } return true } func IsSortedForward(data sort.Interface) bool { n := data.Len() f

Re: [go-nuts] Change imaginary part of a complex

2017-04-20 Thread Michael Jones
It would be natural if real(c) and imag(c) were lvalues On Thu, Apr 20, 2017 at 1:21 PM 'Thomas Bushnell, BSG' via golang-nuts < golang-nuts@googlegroups.com> wrote: > The other way is to add the c to its conjugate and then add the imaginary > part, using cmplx.Conj. But that really amounts to wh

[go-nuts] Re: Large GC pauses with large map

2017-04-20 Thread 刘桂祥
try use value type example: map[string]*struct => map[[20]byte]struct 在 2017年4月20日星期四 UTC+8下午9:49:49,Lee Armstrong写道: > > See attached graph which shows the GC pauses of an application we have. > > I am frequently seeing pauses of 1-1.5 seconds. This is using Go 1.8.1 and > have a large map th

Re: [go-nuts] Why sort.IsSorted implemented with decrement?

2017-04-20 Thread Rob Pike
Try it the other way. You'll see it's not so clean. -rob On Thu, Apr 20, 2017 at 7:47 PM, Ian Lance Taylor wrote: > On Thu, Apr 20, 2017 at 2:14 AM, wrote: > > > > At the moment it is implemented as > > > >295 func IsSorted(data Interface) bool { > >296 n := data.Len() > >297 for

[go-nuts] Re: OpenGL Fonts

2017-04-20 Thread saif
Found an antialiased, 2D vector drawing libray. This should work. github.com/memononen/nanovg Thanks, S -- 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-

[go-nuts] [ANN] sqlite

2017-04-20 Thread Jan Mercl
Early preview of a DB driver for SQLite without CGO: https://github.com/cznic/sqlite ATM Linux/Intel only. -- -j -- 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

Re: [go-nuts] Why sort.IsSorted implemented with decrement?

2017-04-20 Thread Ian Lance Taylor
On Thu, Apr 20, 2017 at 2:14 AM, wrote: > > At the moment it is implemented as > >295 func IsSorted(data Interface) bool { >296 n := data.Len() >297 for i := n - 1; i > 0; i-- { >298 if data.Less(i, i-1) { >299 return false >300 } >301 } >302 return true >303 }

Re: [go-nuts] how dose netpollblock been awaked while sysmon slepp?

2017-04-20 Thread Ian Lance Taylor
On Thu, Apr 20, 2017 at 5:45 AM, sydnash wrote: > > how did you debug the go runtime? use print or gcc, or some other tools? Mostly by adding print statements, and tracing (see the GODEBUG environment variable). Ian -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: OpenGL Fonts

2017-04-20 Thread saif
image atlas will assume that all needed fonts will fit in "image.NewRGBA (image.Rect(0, 0, 1024, 1024))", right? can i can call loadglyph(), when when a rune is needed? or should i call LoadGlyphs() with all possible runes during initialization? i think this will be slow, if i will initialize Loa

[go-nuts] Re: OpenGL Fonts

2017-04-20 Thread saif
thanks, didn't know about that. On Thursday, April 20, 2017 at 2:52:53 PM UTC+8, Egon wrote: > > On Tuesday, 18 April 2017 08:02:02 UTC+3, saif wrote: >> >> Hi, >> >> I like to ask for your suggestions. >> >> I found a nice project, and was trying to modify them but got stuck with >> fonts. >> (g

Re: [go-nuts] Re: Semicolons in Go

2017-04-20 Thread John McKown
On Thu, Apr 20, 2017 at 12:20 PM, Michael Jones wrote: > > On Thu, Apr 20, 2017 at 8:27 AM, wrote: > >> If I can't format my programs the way I want, and I much prefer putting >> operators at the beginning of continuation lines for reasons mentioned on >> this page, and "Perl Best Practices", I

Re: [go-nuts] Change imaginary part of a complex

2017-04-20 Thread 'Thomas Bushnell, BSG' via golang-nuts
The other way is to add the c to its conjugate and then add the imaginary part, using cmplx.Conj. But that really amounts to what you're doing already. On Thu, Apr 20, 2017 at 3:20 AM Val wrote: > Hello folks > To keep real part of a complex, and set its imag part, I'm doing > c = complex(real

[go-nuts] Re: about the []byte -> string comversion optimization, is it some weird?

2017-04-20 Thread 'Keith Randall' via golang-nuts
On Wednesday, April 19, 2017 at 3:56:21 AM UTC-7, T L wrote: > > > > On Wednesday, April 19, 2017 at 3:37:29 AM UTC+8, Keith Randall wrote: >> >> This is a weird corner case in string concatenation optimization. >> >> runtime.concatstrings (what the + in this code gets rewritten to) has an >> op

[go-nuts] Re: Semicolons in Go

2017-04-20 Thread ojucie
Thank you. On Thursday, April 20, 2017 at 2:04:33 PM UTC-3, John Deighan wrote: > > If I can't format my programs the way I want, and I much prefer putting > operators at the beginning of continuation lines for reasons mentioned on > this page, and "Perl Best Practices", I simply won't use the l

Re: [go-nuts] Re: Semicolons in Go

2017-04-20 Thread Michael Jones
On Thu, Apr 20, 2017 at 8:27 AM, wrote: > If I can't format my programs the way I want, and I much prefer putting > operators at the beginning of continuation lines for reasons mentioned on > this page, and "Perl Best Practices", I simply won't use the language - at > least not without implementi

[go-nuts] Re: x509.Certificate.Verify: "x509: certificate signed by unknown authority"

2017-04-20 Thread Simon Ritchie
Are you trying to figure out why this happens, or do you just want a self-signed certificate that works with Go? Assuming that you want to generate a working certificate, I did some work in this area a few weeks ago and encountered problems.. I found some instructions via Google for creating

[go-nuts] Re: Semicolons in Go

2017-04-20 Thread john . deighan
If I can't format my programs the way I want, and I much prefer putting operators at the beginning of continuation lines for reasons mentioned on this page, and "Perl Best Practices", I simply won't use the language - at least not without implementing a pre-processor. Automatic semicolon insert

[go-nuts] Possible to run tests against a specific Go binary?

2017-04-20 Thread st ov
As part of a build pipeline, I want to initially artifact the Go binary to send through all the stages from development to production. How can I run a set of tests (*_test.go) against this one binary? Can I only have blackbox tests or is whitebox possible? Or will the approach need to be, to ru

[go-nuts] Re: Best practice for Method Receivers

2017-04-20 Thread st ov
Thanks! Really appreciate the explanation! On Monday, April 3, 2017 at 6:49:02 AM UTC-7, Val wrote: > > It's a combination of : > 1) A read and a write of a variable, happening without synchronization > (see happens-before ), is always a > race, and always a bu

Re: [go-nuts] sql/driver: why the Result.LastInsertId method doesn't follow the Go's style for Initialisms?

2017-04-20 Thread Michael Banzon
I realize now (about a minute to late) that the "ID" case is mentioned specifically in the link you gave - option two it is ;-) tor. 20. apr. 2017 kl. 17.50 skrev Michael Banzon : > I don't (really) know. > > One reason could be that the "Id" is not an acronym whereas URL is. > > Another reason co

Re: [go-nuts] sql/driver: why the Result.LastInsertId method doesn't follow the Go's style for Initialisms?

2017-04-20 Thread Michael Banzon
I don't (really) know. One reason could be that the "Id" is not an acronym whereas URL is. Another reason could be that this is how it was written for go1 and now it can't be changed due to compatibility. tor. 20. apr. 2017 kl. 15.50 skrev : > While working with the driver package, I had to impl

Re: [go-nuts] Pointer to Container Type

2017-04-20 Thread dc0d
You might be right. This design is from more than one year ago, in transition from C# to Go (the excuse). Yet, as I've asked, I've not found a workaround for it. This is the ripped of essence of this part: type Person struct{} type Owner interface { BelongsTo(*Person) (interface{}, error) }

[go-nuts] Re: Why sort.IsSorted implemented with decrement?

2017-04-20 Thread Val
I don't know the answer but here is a conjecture : slices grow at the end (through append), so a recent un-sortedness would be likely to be found near the end of the slice. (slices are the most commonly used types for "data", correct me if I'm wrong) On a related note, a while ago I microbench

Re: [go-nuts] Large GC pauses with large map

2017-04-20 Thread Jesper Louis Andersen
A somewhat common culprit seems to be the following case: 1. In order for the GC to switch from marking to sweeping, it needs all cores to agree. This requires a "barrier" in the system and thus we have to wait on all CPUs. 2. The barrier check happens on a function call. 3. A CPU core is currentl

[go-nuts] Re: Large GC pauses with large map

2017-04-20 Thread Egon
Use a custom map implementation. On Thursday, 20 April 2017 16:49:49 UTC+3, Lee Armstrong wrote: > > See attached graph which shows the GC pauses of an application we have. > > I am frequently seeing pauses of 1-1.5 seconds. This is using Go 1.8.1 and > have a large map that is frequently accesse

[go-nuts] Why sort.IsSorted implemented with decrement?

2017-04-20 Thread zerkmss
Hi At the moment it is implemented as 295 func IsSorted(data Interface) bool { 296 n := data.Len() 297 for i := n - 1; i > 0; i-- { 298 if data.Less(i, i-1) { 299return false 300 } 301

[go-nuts] sql/driver: why the Result.LastInsertId method doesn't follow the Go's style for Initialisms?

2017-04-20 Thread ariel
While working with the driver package, I had to implement the Result interface. my first instinct was to write the LastInsertId method as "LastInsertID", but then the build failed and I figured out what was the problem. What's the reason that the Result interface doesn't follow the Go's style

Re: [go-nuts] how dose netpollblock been awaked while sysmon slepp?

2017-04-20 Thread sydnash
thank you, i got it. how did you debug the go runtime? use print or gcc, or some other tools? Thank you for tolerate my grammatical mistakes again. 在 2017年4月20日星期四 UTC+8上午11:59:06,Ian Lance Taylor写道: > > On Wed, Apr 19, 2017 at 7:42 PM, 代君 > > wrote: > > > > i have a test code like this: > > f

Re: [go-nuts] what is the best way to to convert c++ std::string to go string in cgo programing?

2017-04-20 Thread Frits van Bommel
Please reply to the mailing list (use "reply all"). On Thu, Apr 20, 2017 at 4:39 AM, hui zhang wrote: > Thank you , I believe most function will return string instead of string& > I test return string function , as expected it return the wrong value > as the string is invalid out of function

[go-nuts] Change imaginary part of a complex

2017-04-20 Thread Val
Hello folks To keep real part of a complex, and set its imag part, I'm doing c = complex(real(c), -5.0) Is there a more concise way, something like c.imag = -5.0 ? I know this one doesn't compile, but I may be missing something obvious. -- You received this message because you are subscrib

Re: [go-nuts] Zero value of the map

2017-04-20 Thread Jan Mercl
On Thu, Apr 20, 2017 at 9:42 AM Will Faught wrote: > Why couldn't maps be implemented as a pointer to the map implementation? If you try to use the map and the pointer is nil, then the map allocates the backing implementation. Pseudocode for a built-in implementation: > > type map struct { > impl

Re: [go-nuts] Zero value of the map

2017-04-20 Thread Will Faught
Why couldn't maps be implemented as a pointer to the map implementation? If you try to use the map and the pointer is nil, then the map allocates the backing implementation. Pseudocode for a built-in implementation: type map struct { impl *mapimpl } func (m map) set(k, v interface{}) { // u