Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the number of " .jl "File of included affects the speed of calling some function ? #8834

Closed
songroom opened this issue Oct 28, 2014 · 7 comments

Comments

@songroom
Copy link

i have a issue:
if the program has more include .jl Files , But when the program calls some function of a .jl File included, the time of running the function has a different from less include File.

My Test:

Head A: 
if true
    using ToolModuleNew
    using ReportModuleNew
    using Dates
    using Gadfly
    using Cairo
    #using HDF5,JLD
    include("D:/strategyJulia/strategyGroup/BBGS_days_fun.jl");
    include("D:/strategyJulia/strategyGroup/JUMP_days_fun.jl");
    include("D:/strategyJulia/strategyGroup/BBGS_plus_days_fun.jl");
    include("D:/strategyJulia/strategyGroup/BBGS_pre_days_fun.jl");
    include("D:/strategyJulia/strategyGroup/XWZY_pre_days_fun.jl");
    include("D:/strategyJulia/strategyGroup/WWWQ_pre_days_fun.jl");
    include("D:/strategyJulia/strategyGroup/SSTZ_days_fun.jl");
    include("D:/strategyJulia/strategyGroup/JLTX_days_fun.jl")
    include("D:/strategyJulia/strategyGroup/YNYS_days_fun.jl")
    include("D:/strategyJulia/strategyGroup/JBHH_days_fun.jl")
    include("D:/strategyJulia/strategyGroup/WJBF_fun.jl") 
    include("D:/strategyJulia/strategyGroup/JSCT_days_fun.jl")
    include("D:/strategyJulia/strategyGroup/TGLJ_days_fun.jl")
    include("D:/strategyJulia/strategyGroup/JSWKNew.jl") # test
    include("D:/strategyJulia/strategyGroup/XQXA_days_fun.jl") 
    include("D:/strategyJulia/strategyGroup/ZZCC_days_fun.jl")
    include("D:/strategyJulia/strategyGroup/ZHSH_fun.jl")
 end

 Head B
 if true
    using ToolModuleNew
    using ReportModuleNew
    using Dates
    using Gadfly
    using Cairo
    #using HDF5,JLD
    include("D:/strategyJulia/testfun.jl");
    include("D:/strategyJulia/Test/T1026.jl");
    include("D:/strategyJulia/Test/T1027.jl");
    include("D:/strategyJulia/Test/T1028A.jl");
    include("D:/strategyJulia/strategyGroup/WWWQ_pre_days_fun.jl");
 end

question:

if my program adds the Head A, the time of calling the function WWWQ_pre_days_fun.jl only is 11.504999876022339 seconds.
but my program adds the Head B, the time of calling the function WWWQ_pre_days_fun.jl only is
3.9060001373291016 seconds!

11.5 seconds VS 3.9 seconds!!

why???
@ihnorton
Copy link
Member

why???

Parsing and compiling everything takes time - longer than we would like, right now. The end-user issue here will be addressed by #8745, and there are already other issues for compiler performance.

@JeffBezanson
Copy link
Member

I'm a little confused by this report. WWWQ_pre_days_fun.jl is a source file, not a function. Are you waiting for all these includes to be processed, then calling a function defined in those files, or timing how long it takes to include everything?

@songroom
Copy link
Author

WWWQ_pre_days_fun.jl is function .jl ,as follow.(part)

function WWWQ_pre_days_fun(TGP::tradeGeneralParameters, data::Dict{Date,Dict{String,Array{kBarData,1}}},windowLength::Int64,enterN::Float64 ,exitN::Float64,baseTime::Int64,barMin::Int64,isMustCloseToday::Bool)

        println("WWWQ_pre_days_fun!")
        instrumentInfo       = getInstrumentInfo(TGP.instrument );
        tradeFeeTh            = instrumentInfo[1].TradeFee  # 计算交易费用
        if TGP.instrument=="IF"
               impactCostUnit      = 1.0*instrumentInfo[1].OneTickValue # 计算冲击成本,暂时冲击成本以1个TICK来计算
        else
               impactCostUnit      = 1.0*instrumentInfo[1].OneTickValue # 计算冲击成本,暂时冲击成本以1个TICK来计算
        end
        DrawDownTh        = TGP.highDownTh;
        DrawUpTh             = TGP.lowUpTh;
        StopLossTh            = TGP.stopLossTh;
        StopProfTh            = TGP.stopProfTh;
        lastOpenTime         = TGP.lastOpenTime;
        lastCloseTime         = TGP.lastCloseTime;
        instrument              = TGP.instrument;
        multiplier                = TGP.multiplier
        tradeVolume           = TGP. tradeVolume ;#手数   有问题,商品的手数有不同的变化
        maxTradeCount      = TGP. maxTradeCount; #当日最大交易次数
        strategyName          = TGP.strategyName
        tradeDates               =  sort(collect(keys(data)))
        tradeFlows               =  tradeFlow[];
        # 默认参数,主要是一些辅助参数,估计差问题不大
        #historyDataDays          = 10; # 10:在当天获取当天前10天的数据。慢周期往往需要更长的时间数据
        marketCloseTime            = lastCloseTime; # COM:15:00     IF:1515
        shiftTime                        = marketCloseTime-barMin;#  在正常的情况下,迁月在交割日前完成,但如果在交割日当天迁月,则不能晚于1500
        shiftBarLength                = (marketCloseTime-shiftTime)/barMin +2; # 在迁月循还中,循还的长度
        #
        startTime1                        = time();
        println("$strategyName  策略开始启动......")
       ........
end

@songroom
Copy link
Author

11.5 seconds or 3.9 seconds does not include the time of processing the includes. they are only the time of the function run.

@songroom
Copy link
Author

thanks!

------------------ 原始邮件 ------------------
发件人: "Isaiah";[email protected];
发送时间: 2014年10月29日(星期三) 凌晨1:23
收件人: "JuliaLang/julia"[email protected];
抄送: "个人-尘微"[email protected];
主题: Re: [julia] the number of " .jl "File of included affects the speedof calling some function ? (#8834)

why???
Parsing and compiling everything takes time - longer than we would like, right now. The end-user issue here will be addressed by #8745, and there are already other issues for compiler performance.


Reply to this email directly or view it on GitHub.

@songroom
Copy link
Author

thanks!

------------------ 原始邮件 ------------------
发件人: "Jeff Bezanson";[email protected];
发送时间: 2014年10月29日(星期三) 凌晨1:29
收件人: "JuliaLang/julia"[email protected];
抄送: "个人-尘微"[email protected];
主题: Re: [julia] the number of " .jl "File of included affects the speedof calling some function ? (#8834)

I'm a little confused by this report. WWWQ_pre_days_fun.jl is a source file, not a function. Are you waiting for all these includes to be processed, then calling a function defined in those files, or timing how long it takes to include everything?


Reply to this email directly or view it on GitHub.

@songroom
Copy link
Author

sorry, i make a mistake. it is closed! thanks all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants