View Single Post
Old 6th July 2014, 15:33   #24  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
Quote:
Originally Posted by Gavino View Post
As StainlessS says, the string argument to ScriptClip() is instantiated once only, when the outer script is parsed.

However, at run-time, that string is itself parsed afresh by ScriptClip() for every frame, each time using up space in Avisynth's string table for variable names, etc.
Somewhat naïve testing seems to indicate that this applies equally much to FrameEvaluate() as might be expected; does the theory agree?

scriptclip.avs
Code:
fps = 25.0
BlankClip(length=Int(3600*fps), fps=fps)
evens = 0
ScriptClip("""
    evens = current_frame / 2 * 2 == current_frame \
        ? evens + 1 \
        : evens
    last
""", show=false, after_frame=false)
scriptclip2.avs
Code:
fps = 25.0
BlankClip(length=2*Int(3600*fps), fps=fps)
evens = 0
ScriptClip("""
    evens = current_frame / 2 * 2 == current_frame \
        ? evens + 1 \
        : evens
    last
""", show=false, after_frame=false)
frameevaluate.avs
Code:
fps = 25.0
BlankClip(length=Int(3600*fps), fps=fps)
evens = 0
FrameEvaluate("""
    evens = current_frame / 2 * 2 == current_frame \
        ? evens + 1 \
        : evens
#   last
""", show=false, after_frame=false)
frameevaluate2.avs
Code:
fps = 25.0
BlankClip(length=2*Int(3600*fps), fps=fps)
evens = 0
FrameEvaluate("""
    evens = current_frame / 2 * 2 == current_frame \
        ? evens + 1 \
        : evens
#   last
""", show=false, after_frame=false)
Quote:
>avsmeter scriptclip.avs

AVSMeter 1.7.9 (AVS 2.6, x86) by Groucho2004
AviSynth 2.60, build:Jan 14 2013 [16:50:35]

Number of frames: 90000
Length (hhh:mm:ss.ms): 001:00:00.000
Frame width: 640
Frame height: 480
Framerate: 25.000 (25/1)
Colorspace: RGB32

Frames processed: 90000 (0 - 89999)
FPS (min | max | average): 66717 | 97485 | 91832
CPU usage (average): 23%
Thread count: 1
Physical Memory usage (peak): 15 MB
Virtual Memory usage (peak): 12 MB
Time (elapsed): 000:00:00.980

>avsmeter scriptclip2.avs

AVSMeter 1.7.9 (AVS 2.6, x86) by Groucho2004
AviSynth 2.60, build:Jan 14 2013 [16:50:35]

Number of frames: 180000
Length (hhh:mm:ss.ms): 002:00:00.000
Frame width: 640
Frame height: 480
Framerate: 25.000 (25/1)
Colorspace: RGB32

Frames processed: 180000 (0 - 179999)
FPS (min | max | average): 69540 | 97453 | 92068
CPU usage (average): 24%
Thread count: 1
Physical Memory usage (peak): 20 MB
Virtual Memory usage (peak): 18 MB
Time (elapsed): 000:00:01.955

>avsmeter frameevaluate.avs

AVSMeter 1.7.9 (AVS 2.6, x86) by Groucho2004
AviSynth 2.60, build:Jan 14 2013 [16:50:35]

Number of frames: 90000
Length (hhh:mm:ss.ms): 001:00:00.000
Frame width: 640
Frame height: 480
Framerate: 25.000 (25/1)
Colorspace: RGB32

Frames processed: 90000 (0 - 89999)
FPS (min | max | average): 94501 | 115677 | 110254
CPU usage (average): 22%
Thread count: 1
Physical Memory usage (peak): 14 MB
Virtual Memory usage (peak): 12 MB
Time (elapsed): 000:00:00.816

>avsmeter frameevaluate2.avs

AVSMeter 1.7.9 (AVS 2.6, x86) by Groucho2004
AviSynth 2.60, build:Jan 14 2013 [16:50:35]

Number of frames: 180000
Length (hhh:mm:ss.ms): 002:00:00.000
Frame width: 640
Frame height: 480
Framerate: 25.000 (25/1)
Colorspace: RGB32

Frames processed: 180000 (0 - 179999)
FPS (min | max | average): 96123 | 114681 | 110382
CPU usage (average): 23%
Thread count: 1
Physical Memory usage (peak): 19 MB
Virtual Memory usage (peak): 17 MB
Time (elapsed): 000:00:01.631
fvisagie is offline   Reply With Quote