{"action":"created","issue":{"url":"https://api.github.com/repos/QuantBox/QuantBox_XAPI/issues/8","labels_url":"https://api.github.com/repos/QuantBox/QuantBox_XAPI/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/QuantBox/QuantBox_XAPI/issues/8/comments","events_url":"https://api.github.com/repos/QuantBox/QuantBox_XAPI/issues/8/events","html_url":"https://github.com/QuantBox/QuantBox_XAPI/issues/8","id":56892368,"number":8,"title":"速度没有达到自己所想","user":{"login":"wukan1986","id":1826707,"avatar_url":"https://avatars.githubusercontent.com/u/1826707?v=3","gravatar_id":"","url":"https://api.github.com/users/wukan1986","html_url":"https://github.com/wukan1986","followers_url":"https://api.github.com/users/wukan1986/followers","following_url":"https://api.github.com/users/wukan1986/following{/other_user}","gists_url":"https://api.github.com/users/wukan1986/gists{/gist_id}","starred_url":"https://api.github.com/users/wukan1986/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wukan1986/subscriptions","organizations_url":"https://api.github.com/users/wukan1986/orgs","repos_url":"https://api.github.com/users/wukan1986/repos","events_url":"https://api.github.com/users/wukan1986/events{/privacy}","received_events_url":"https://api.github.com/users/wukan1986/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-07T01:58:39Z","updated_at":"2015-02-07T10:48:30Z","closed_at":null,"body":"目前C#层返回的数据太慢。\r\n\r\n我先现的想法是先把消息队列给改了，弄成内存池。\r\n力争减少复制。\r\n\r\n但从C++到C#还是太慢。\r\n\r\n欢迎大家提供意见。\r\n"},"comment":{"url":"https://api.github.com/repos/QuantBox/QuantBox_XAPI/issues/comments/73359308","html_url":"https://github.com/QuantBox/QuantBox_XAPI/issues/8#issuecomment-73359308","issue_url":"https://api.github.com/repos/QuantBox/QuantBox_XAPI/issues/8","id":73359308,"user":{"login":"mepwang","id":6652450,"avatar_url":"https://avatars.githubusercontent.com/u/6652450?v=3","gravatar_id":"","url":"https://api.github.com/users/mepwang","html_url":"https://github.com/mepwang","followers_url":"https://api.github.com/users/mepwang/followers","following_url":"https://api.github.com/users/mepwang/following{/other_user}","gists_url":"https://api.github.com/users/mepwang/gists{/gist_id}","starred_url":"https://api.github.com/users/mepwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mepwang/subscriptions","organizations_url":"https://api.github.com/users/mepwang/orgs","repos_url":"https://api.github.com/users/mepwang/repos","events_url":"https://api.github.com/users/mepwang/events{/privacy}","received_events_url":"https://api.github.com/users/mepwang/received_events","type":"User","site_admin":false},"created_at":"2015-02-07T10:48:30Z","updated_at":"2015-02-07T10:48:30Z","body":"在Linux Mint 17.1 64-bit上用mono做了Profiling，节选结果附后。\r\n测试代码是我自己写的，主要调用了ReqQryInstrument和Subscribe\r\n注意到其中耗时最长的是（应该超过了95%的时间吧）：\r\n39990    39990         80 unknown method 0x7f5200022150\r\n我猜测是本地方法调用在耗时。\r\n我觉得可能是C++库中的线程通信问题，等我有时间对库做Profiling看看\r\n时间都被消耗到哪里了。\r\n\r\nMethod call summary\r\nTotal(ms) Self(ms)      Calls Method name\r\n   40621        0         10 (wrapper runtime-invoke) <Module>:runtime_invoke_void__this___object (object,intptr,intptr,intptr)\r\n   40620        0          1 unknown method 0x1436278\r\n   40620        0          1 unknown method 0x143d860\r\n   40620        0          1 unknown method 0x143d888\r\n   40620        0          1 unknown method 0x143dd20\r\n   40620        0          1 unknown method 0x14068f0\r\n   40619        0          1 QuantBox.XAPI.NetQuote:<NetQuote>m__0 ()\r\n   40010        0          1 System.Collections.Concurrent.BlockingCollection`1:Take ()\r\n   40010        0          1 System.Collections.Concurrent.BlockingCollection`1:Take (System.Threading.CancellationToken)\r\n   40010        1          1 System.Collections.Concurrent.BlockingCollection`1:TryTake (T&,int,System.Threading.CancellationToken,bool)\r\n   40004        1         81 System.Threading.ManualResetEventSlim:Wait (int,System.Threading.CancellationToken)\r\n   39992        1         80 unknown method 0x13a94a8\r\n   39990    39990         80 unknown method 0x7f5200022150\r\n    1707        1        305 (wrapper native-to-managed) QuantBox.XAPI.Callback.BaseApi:_OnRespone (byte,intptr,intptr,double,double,intptr,int,intptr,int,intptr,int)\r\n    1705        1        305 QuantBox.XAPI.Callback.BaseApi:_OnRespone (byte,intptr,intptr,double,double,intptr,int,intptr,int,intptr,int)\r\n    1423        1        296 QuantBox.XAPI.Callback.XApi:OnRespone (byte,intptr,intptr,double,double,intptr,int,intptr,int,intptr,int)\r\n    1420        2        295 QuantBox.XAPI.Callback.XApi:_OnRspQryInstrument (intptr,int,double)\r\n    1399        6        295 QuantBox.XAPI.NetTrade:OnRspQryInstrument (object,QuantBox.XAPI.InstrumentField&,int,bool)\r\n    1003        2        899 unknown method 0x7f51d400aeb0\r\n    1000       28        899 unknown method 0x7f51d400ae60\r\n     957        3        598 unknown method 0x7f51d400aed8\r\n     945        0          2 System.Configuration.Configuration:.ctor (System.Configuration.InternalConfigurationSystem,string)\r\n     906        0        303 unknown method 0x1343540\r\n     905        6        303 unknown method 0x7f51d4004cd0\r\n     878        0        102 (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)\r\n     877        1        303 System.IO.TextWriter:WriteLine (string)\r\n     598        5        266 System.Xml.XmlWriter:WriteNode (System.Xml.XmlReader,bool)\r\n     568        0          4 NetMQ.zmq.Mailbox:.ctor (string)\r\n     566        0          1 NetMQ.NetMQContext:Create ()\r\n     566        0          1 NetMQ.zmq.ZMQ:CtxNew ()\r\n     565        0          1 NetMQ.zmq.Ctx:.ctor ()\r\n     563       36       2079 unknown method 0x7f51d40040a8\r\n     562        0          4 NetMQ.zmq.Signaler:.ctor ()\r\n     554        1          4 NetMQ.zmq.Signaler:MakeFDpair ()\r\n     544        1          1 System.Net.Sockets.Socket:.cctor ()\r\n     543        1          1 System.Net.Sockets.Socket:CheckProtocolSupport ()\r\n     540        0          1 System.Configuration.ConfigurationManager:GetSection (string)\r\n     540        0          1 System.Configuration.ClientConfigurationSystem:System.Configuration.Internal.IInternalConfigSystem.GetSection (string)\r\n     496        5        296 System.Text.Encoding:InvokeI18N (string,object[])\r\n     478        0          1 System.Configuration.ClientConfigurationSystem:get_Configuration ()\r\n     477        1          1 System.Configuration.ConfigurationManager:OpenExeConfigurationInternal (System.Configuration.ConfigurationUserLevel,System.Reflection.Assembly,string)\r\n     474        0          1 System.Configuration.InternalConfigurationFactory:Create (System.Type,object[])"}}