On Monday, 21 November 2016 17:30:21 UTC+2, Vorn Mom wrote:
> Sorry if it was asked before, but where should interfaces live?
>
>- In the package that contains an implementation of it.
>- In its own package.
>- or in the package that needs it.
>
> The quick answer here is "yes to all",
Please try profiling your application, if you are on Linux perf(1) works very
well for tracing user and system time.
--
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
On Tuesday, 22 November 2016 17:46:18 UTC+8, Dave Cheney wrote:
>
> Please try profiling your application, if you are on Linux perf(1) works
> very well for tracing user and system time.
Thanks for mention that :)
Here is the first step result of *perf stat*:
Performance counter stats for
Perf record / report will highlight the problem.
--
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
Related, you don't need a pointer to a chan, channels are already pointers to
the private runtime channel type.
--
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
Please do not reopen to a four year old thread. Instead please start a new
thread describing the problem you have, what you tried, and what happened when
you tried.
Thanks
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from thi
On Tuesday, 22 November 2016 18:06:50 UTC+8, Dave Cheney wrote:
>
> Perf record / report will highlight the problem.
Thanks Dave.And here is the output of the perf report:
Samples: 48K of event 'cpu-clock', Event count (approx.): 1202025
Overhead Command Shared Object Symbol
59.40
Hi Dave,
I need to create a common utility which checks whether the struct is empty
or not else i can throw error.
for example:
type Employee struct{
EmpId string
EmpName string
Department []String
Projects map[string]string
}
i need to check whether the object co
On Tuesday, 22 November 2016 18:08:37 UTC+8, Dave Cheney wrote:
>
> Related, you don't need a pointer to a chan, channels are already pointers
> to the private runtime channel type.
Thanks for telling me that ☺ The codes will be pretty cleaner without the
pointer '*' notation.
Is there somet
Hello!
"Real" is what I see in atop/htop/ps, as i mentioned erlier.
Yep, about asked memory from OS is in my mind too, but how can I find
situation when/why it's occur?
To be more precise, my app load N merabytes from DB, and put them into map.
So, I fully understand when N megabytes transform
If you want to write a general function you will need to use the reflect
package, specifically reflect.Value.IsValid to check each field to see if it
contains the zero value or not.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe
Please turn on gc debugging with end GODEBUG=gctrace=1 and check that your
applications heap usage is behaving as you believe.
--
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, sen
Why do you want to use LockOSthread, you've proved it has a significant
performance cost for your application.
--
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 go
i am new to Golang.
can you just share some piece of code just to check each field in struct
for empty or nil or zero value.
On Tue, Nov 22, 2016 at 4:19 PM, Dave Cheney wrote:
> If you want to write a general function you will need to use the reflect
> package, specifically reflect.Value.IsVal
On Tuesday, 22 November 2016 18:51:46 UTC+8, Dave Cheney wrote:
>
> Why do you want to use LockOSthread, you've proved it has a significant
> performance cost for your application.
*Cgo* is the answer.
(Actually I want to use a C library(which needs LockOSthread to reach local
constant
>From my point of view, the main difference is that interfaces are strictly
more powerful, because you can't dynamically type convert a function
type into something different.
You can always make an interface from a function (e.g. http.HandlerFunc
and the like) but not the other way around.
This
This should get you started. https://play.golang.org/p/fKGkJPMToy
On Tuesday, 22 November 2016 21:58:31 UTC+11, iAdvice Edge wrote:
>
> i am new to Golang.
>
> can you just share some piece of code just to check each field in struct
> for empty or nil or zero value.
>
> On Tue, Nov 22, 2016 at 4:
The cgo call is going to cost you a lot more than this. Can you write up
your real code and profile it.
On Tuesday, 22 November 2016 22:11:34 UTC+11, Cia wrote:
>
>
>
> On Tuesday, 22 November 2016 18:51:46 UTC+8, Dave Cheney wrote:
>>
>> Why do you want to use LockOSthread, you've proved it has
I have been tested Cgo's perf and here is the result below:
chan:
1000, op/s (buffer 100)
400, op/s (no buffer,blocked)
cgo:
554,4729 op/s
It shows that the speed of Cgo is acceptable,and even without thinking
about the batch optimization method when using it *:)*
On Tuesday, 22 Novemb
i know this depends on a lot of variables, but i don't need something
accurate
if from your experience you could guess how much an app like this would
need?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop
To answer this kind of question, i normally write a simple app, then run it
on localhost, then use ab tool to test.
e.g to send 100,000 requests 100 at a time, ab -n 10 -c 100
http://localhost:3000/
Then i use 'top' to see how much cpu/ram its using.
On Tue, Nov 22, 2016 at 3:27 PM, Marwan
Hi,
I'd like to implement a Client app in go which accesses to a Java HTTPS
server and it uses the TLS Session-ID to protect against Man-in-the-middle
attack and bind to one single TLS Session. When I use the Java Servlet the
specification
http://download.oracle.com/otn-pub/jcp/servlet-3.0-fr
i will try that, thanks
On Tuesday, November 22, 2016 at 3:24:19 PM UTC+2, Josh Kamau wrote:
>
> To answer this kind of question, i normally write a simple app, then run
> it on localhost, then use ab tool to test.
> e.g to send 100,000 requests 100 at a time, ab -n 10 -c 100
> http://loc
Thanks Shawn & Andrew for your replies.
Ignoring the TZ abbreviation when it doesn't happen to be the local TZ
seems like somewhat undesirable behavior. Unfortunately I can't work around
this by switching to numeric zones, since I'm not in control of the input
I'm parsing. Is there a fundamenta
On Tue, Nov 22, 2016 at 10:30 AM, wrote:
>
> Ignoring the TZ abbreviation when it doesn't happen to be the local TZ seems
> like somewhat undesirable behavior. Unfortunately I can't work around this
> by switching to numeric zones, since I'm not in control of the input I'm
> parsing. Is there a f
Thinking about this overnight I think this benchmark
https://play.golang.org/p/5d4MUKqPYd
Shows the issue you are having. On my machine
% go test -bench=. -benchtime=5s
BenchmarkWithoutLockOSThread-4 5000 1827196 ns/op
BenchmarkWithLockOSThread-4 200 31506649 ns/op
My guess is the LockOSThrea
On Tue, Nov 22, 2016 at 12:37 PM, Dave Cheney wrote:
> Thinking about this overnight I think this benchmark
>
> https://play.golang.org/p/5d4MUKqPYd
>
> Shows the issue you are having. On my machine
>
> % go test -bench=. -benchtime=5s
> BenchmarkWithoutLockOSThread-4 5000 1827196 ns/op
> Benchmar
I just started leaning Go and I've been stuck on this for a couple of days
Running on an App Engine dev server
The idea is to get an object I can work with with a format like this:
{
"Results": [
{
"username": "Test username",
"username_sani": "testusername",
"dob": "19
Thanks Ian.
On Wed, 23 Nov 2016, 07:47 Ian Lance Taylor wrote:
> On Tue, Nov 22, 2016 at 12:37 PM, Dave Cheney wrote:
> > Thinking about this overnight I think this benchmark
> >
> > https://play.golang.org/p/5d4MUKqPYd
> >
> > Shows the issue you are having. On my machine
> >
> > % go test -be
First of all, please NEVER ignore the returned errors!
Then, print out "doc" to be sure.
In the concrete case, let Results be []json.RawMessage, or simply marshal
into a map[string]interface{}.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To
Hi,
How to architect the OO's virtual function in Go?
Please take a look at this (not working) Go program
https://play.golang.org/p/qrBX6ScABp
Please think of the "func Output()" as a very complicated function that I
only want to define *once *at the base level, not to duplicate into each
su
On Wed, Nov 23, 2016 at 8:16 AM, Tong Sun wrote:
> Hi,
>
> How to architect the OO's virtual function in Go?
>
> Please take a look at this (not working) Go program
> https://play.golang.org/p/qrBX6ScABp
>
> Please think of the "func Output()" as a very complicated function that I
> only want to d
On Tue, Nov 22, 2016 at 10:16 PM, Tong Sun wrote:
> Hi,
>
> How to architect the OO's virtual function in Go?
>
> Please take a look at this (not working) Go program
> https://play.golang.org/p/qrBX6ScABp
>
> Please think of the "func Output()" as a very complicated function that I
> only want to
On Tue, Nov 22, 2016 at 4:29 PM, Seb Binet wrote:
>
>
> On Tue, Nov 22, 2016 at 10:16 PM, Tong Sun wrote:
>
>> Hi,
>>
>> How to architect the OO's virtual function in Go?
>>
>> Please take a look at this (not working) Go program
>> https://play.golang.org/p/qrBX6ScABp
>>
>> Please think of the "fu
On Tue, Nov 22, 2016 at 4:29 PM, Jesse McNelis wrote:
> On Wed, Nov 23, 2016 at 8:16 AM, Tong Sun wrote:
> > Hi,
> >
> > How to architect the OO's virtual function in Go?
> >
> > Please take a look at this (not working) Go program
> > https://play.golang.org/p/qrBX6ScABp
> >
> > Please think of th
On 23 Nov. 2016 9:03 am, "Tong Sun" wrote:
>
> So, once again, thinking in OO, I'll define all of the common variables
in base class, and common functionalities in virtual functions. How to make
that idea work in Go?
>
> For the above specific code, how to easily make "func Output" works?
>
You c
Hi,
There is no direct mapping of what you can do with virtual functions in
other OO languages, and Go. There are different compromises you have to
make; because of this, synthetic examples will probably not help much.
That being said, in the case of your last example I would make Output() a
interfaces only work on methods.
https://play.golang.org/p/o6Ot4IdJZ1
Name, Age , ... are not methods they are fields.You need to make them part
of Speaker interface by using methods instead of fields.
Le mardi 22 novembre 2016 23:03:54 UTC+1, Tong Sun a écrit :
>
>
>
> On Tue, Nov 22, 2016 at
Alright, I will take a look. Thanks for the response.
~Parker
On Monday, November 21, 2016 at 7:00:01 PM UTC-5, Ian Lance Taylor wrote:
>
> On Sun, Nov 20, 2016 at 1:22 PM, Parker Evans > wrote:
> >
> > In order to do this kind of thing, do I need to manually figure out
> > dependencies and
On Tue, Nov 22, 2016 at 6:23 PM, Jesse McNelis wrote:
> On 23 Nov. 2016 9:03 am, "Tong Sun" wrote:
> >
> > So, once again, thinking in OO, I'll define all of the common variables
> in base class, and common functionalities in virtual functions. How to make
> that idea work in Go?
> >
> > For the a
No Nick, making Output() a member method won't work.
See my OP and Jesse's answer. I.e., I have to change it from a member
function to a pure function.
On Tue, Nov 22, 2016 at 6:25 PM, Nick Patavalis
wrote:
> Hi,
>
> There is no direct mapping of what you can do with virtual functions in
> other
Thanks a lot for your explicit example. Much more helpful to me than merely
saying define getters. Much appreciate it!
On Tue, Nov 22, 2016 at 6:27 PM, wrote:
> interfaces only work on methods.
>
> https://play.golang.org/p/o6Ot4IdJZ1
>
> Name, Age , ... are not methods they are fields.You need
42 matches
Mail list logo