POV-Ray : Newsgroups : povray.beta-test : Cached Macros! Server Time
28 Mar 2024 10:03:07 EDT (-0400)
  Cached Macros! (Message 23 to 32 of 32)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Jaime Vives Piqueres
Subject: Re: Cached Macros!
Date: 20 Jul 2016 06:40:04
Message: <578f5504$1@news.povray.org>
El 20/07/16 a las 01:16, clipka escribió:
> Ok, folks -- I've just submitted an update to the macro caching
> mechanism. The 64k (Windows) / 0.5k (Linux) buffer is now bypassed,
> further increasing the parsing speed of Thomas' demo scene on my
> machine from 60 to 50 seconds.
>
> Please test intensively.
>

   Hmmm... here the new version is a bit slower parsing: from 1m20s to
1m23s, either with macros defined inside or outside, and even with
in-between comments no matter the size (I tried several MB of comments
and it still parsed in 1m23s).


3.7.1-alpha.8704732.unofficial (g++ 5.4.0 @ x86_64-pc-linux-gnu)

--
jaime


Post a reply to this message

From: clipka
Subject: Re: Cached Macros!
Date: 20 Jul 2016 07:43:59
Message: <578f63ff$1@news.povray.org>
Am 20.07.2016 um 12:40 schrieb Jaime Vives Piqueres:
> El 20/07/16 a las 01:16, clipka escribió:
>> Ok, folks -- I've just submitted an update to the macro caching
>> mechanism. The 64k (Windows) / 0.5k (Linux) buffer is now bypassed,
>> further increasing the parsing speed of Thomas' demo scene on my
>> machine from 60 to 50 seconds.
>>
>> Please test intensively.
>>
> 
>   Hmmm... here the new version is a bit slower parsing: from 1m20s to
> 1m23s, either with macros defined inside or outside, and even with
> in-between comments no matter the size (I tried several MB of comments
> and it still parsed in 1m23s).

Hmm... maybe that's due to the top layer in the file access
(ITextStream, the one where the buffer used to reside in) now using
polymorphism. Still, it puzzles me a bit why the copying-around of the
macro content does so little to counteract that penalty. Might even have
to do with CPU properties.

Since this 3.6% performance loss on your machine buys a 12% performance
bonus on Thomas' machine, I guess I'm willing to pay that price.


Post a reply to this message

From: Stephen
Subject: Re: Cached Macros!
Date: 20 Jul 2016 08:15:15
Message: <578f6b53$1@news.povray.org>
On 7/20/2016 12:43 PM, clipka wrote:
> Since this 3.6% performance loss on your machine buys a 12% performance
> bonus on Thomas' machine, I guess I'm willing to pay that price.

You put that in, to be commented upon. Didn't you? ;)

-- 

Regards
     Stephen


Post a reply to this message

From: William F Pokorny
Subject: Re: Cached Macros!
Date: 20 Jul 2016 10:59:14
Message: <578f91c2$1@news.povray.org>
On 07/19/2016 07:16 PM, clipka wrote:
> Ok, folks -- I've just submitted an update to the macro caching
> mechanism. The 64k (Windows) / 0.5k (Linux) buffer is now bypassed,
> further increasing the parsing speed of Thomas' demo scene on my machine
> from 60 to 50 seconds.
>
> Please test intensively.
>

Ubuntu 14.04 (i3-4130). Latest always came in faster for me using a 
scene of my own. Inserted an error statement to stop after parsing so 
these times are for the parsing phase. Command suffix the commit.

-------------------------- Disk ----------------------------
povray371_2965368:
Command exited with non-zero status 1
158.46user 3.64system 2:42.42elapsed 99%CPU (0avgtext+0avgdata 
151536maxresident)k
0inputs+6608outputs (0major+28992minor)pagefaults 0swap

povray371_8e965a9:                       -8.60% (elapsed)
Command exited with non-zero status 1
148.02user 0.08system 2:28.45elapsed 99%CPU (0avgtext+0avgdata 
151548maxresident)k
0inputs+6608outputs (0major+28482minor)pagefaults 0swaps

-------------------------- Memory disk ---------------------
povray371_2965368:
Command exited with non-zero status 1
153.68user 3.26system 2:37.26elapsed 99%CPU (0avgtext+0avgdata 
151676maxresident)k
0inputs+0outputs (0major+28482minor)pagefaults 0swaps

povray371_8e965a9:
Command exited with non-zero status 1    -3.85% (elapsed)
150.72user 0.14system 2:31.20elapsed 99%CPU (0avgtext+0avgdata 
151460maxresident)k
0inputs+0outputs (0major+28477minor)pagefaults 0swap

-------------------------- Memory disk (one file) ----------
povray371_2965368:
Command exited with non-zero status 1
151.63user 1.63system 2:33.59elapsed 99%CPU (0avgtext+0avgdata 
151628maxresident)k
0inputs+0outputs (0major+28479minor)pagefaults 0swaps

povray371_8e965a9:
Command exited with non-zero status 1    -3.37% (elapsed)
148.01user 0.07system 2:28.41elapsed 99%CPU (0avgtext+0avgdata 
151556maxresident)k
0inputs+0outputs (0major+28988minor)pagefaults 0swaps


Post a reply to this message

From: clipka
Subject: Re: Cached Macros!
Date: 20 Jul 2016 11:15:44
Message: <578f95a0$1@news.povray.org>
Am 20.07.2016 um 14:15 schrieb Stephen:
> On 7/20/2016 12:43 PM, clipka wrote:
>> Since this 3.6% performance loss on your machine buys a 12% performance
>> bonus on Thomas' machine, I guess I'm willing to pay that price.
> 
> You put that in, to be commented upon. Didn't you? ;)

Absolutely. Substantial ones preferred, thanks :P


Post a reply to this message

From: clipka
Subject: Re: Cached Macros!
Date: 20 Jul 2016 11:23:58
Message: <578f978e$1@news.povray.org>
Am 20.07.2016 um 16:59 schrieb William F Pokorny:

> povray371_2965368:

Just wondering -- which one is that? I failed to find any commit with
that id in the repository.


Post a reply to this message

From: William F Pokorny
Subject: Re: Cached Macros!
Date: 20 Jul 2016 12:22:25
Message: <578fa541$1@news.povray.org>
On 07/20/2016 11:23 AM, clipka wrote:
> Am 20.07.2016 um 16:59 schrieb William F Pokorny:
>
>> povray371_2965368:
>
> Just wondering -- which one is that? I failed to find any commit with
> that id in the repository.
>

POV-Ray 3.7.1-alpha.8697045.unofficial

No idea what happened...

git log --oneline currently shows me:

8e965a9 Improved cached macro performance.
fa3a1dc Fixed a code flaw in macro caching.
39a6c9f [ci skip] Minor changes to comments and dev documentation.
edfae26 Fixed a bug in cleanup of fog with turbulence.
3b5b4eb added missing file pavement_s3_t6_p12.txt / issue #37 (#77)
051b674 Implemented macro caching.
2d0a42c fix filenames / issue #36 (#76)

And looking back through my bash command history 2d0a42c is what I 
checked out ahead of the compile to the pre-cached macro version.

"git checkout 2d0a42c"

Bill P.


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Cached Macros!
Date: 20 Jul 2016 12:32:50
Message: <578fa7b2$1@news.povray.org>
El 20/07/16 a las 13:43, clipka escribió:
> Hmm... maybe that's due to the top layer in the file access
> (ITextStream, the one where the buffer used to reside in) now using
> polymorphism. Still, it puzzles me a bit why the copying-around of
> the macro content does so little to counteract that penalty. Might
> even have to do with CPU properties.

   AMD FX-6300 here...

> Since this 3.6% performance loss on your machine buys a 12%
> performance bonus on Thomas' machine, I guess I'm willing to pay that
> price.
>

   Well, it's still a little loss compared to the huge gain respect to
the old macros mechanism. Good job!

--
jaime


Post a reply to this message

From: Thomas de Groot
Subject: Re: Cached Macros!
Date: 21 Jul 2016 02:13:46
Message: <5790681a$1@news.povray.org>
On 20-7-2016 14:15, Stephen wrote:
> On 7/20/2016 12:43 PM, clipka wrote:
>> Since this 3.6% performance loss on your machine buys a 12% performance
>> bonus on Thomas' machine, I guess I'm willing to pay that price.
>
> You put that in, to be commented upon. Didn't you? ;)
>

I thought so too. So, I agree with Jaime that the principal gain is on 
the outside use of macros and that is more than a bonus. Excellent job 
indeed!

-- 
Thomas


Post a reply to this message

From: Yvo Smellenbergh
Subject: Re: Cached Macros!
Date: 22 Jul 2016 05:20:37
Message: <5791e565@news.povray.org>
On 2016-07-19 23:16:48 +0000, clipka said:

> Ok, folks -- I've just submitted an update to the macro caching
> mechanism. The 64k (Windows) / 0.5k (Linux) buffer is now bypassed,
> further increasing the parsing speed of Thomas' demo scene on my machine
> from 60 to 50 seconds.
> 
> Please test intensively.

And on Macintosh:

- 3.7.0    
allInside: 32,957 sec 
allOutside: 96,369 sec  
rodOutsideRandInside:  481,025 sec  !! (8minutes)

- av155
allInside: 37,021 sec
allOutside:  36,480 sec
rodOutsideRandInside: 36,869 sec



Files used:

// Persistence of Vision Ray Tracer Scene Description File
// File: Clipka_cached macros_test.pov
// Vers: 3.7.1 Cached Macros version
// Desc: Basic Scene Example
// Date: mm/dd/yy
// Auth: ?
//

#version 3.7;

#include "colors.inc"
#declare allInside = 1;
#declare allOutside = 2;
#declare rodOutsideRandInside = 3;
#declare MacroType = allInside;

#if ( (MacroType = allInside) | (MacroType = rodOutsideRandInside))
	 #debug "\nRand inside"
	#macro VRand_In_Box(Mn, Mx, RS) (< rand(RS), rand(RS), 
rand(RS)>*(Mx-Mn) + Mn) #end
	#macro RRand(Min, Max, RS) (rand(RS)*(Max-Min) + Min) #end
	#macro VRand_In_Obj(Obj, RS)
    		#local Mn = min_extent(Obj);
   		 #local Mx = max_extent(Obj);
    		#local Pt = VRand_In_Box(Mn, Mx, RS);
    		#local J = 0;
   		 #while(inside(Obj, Pt) = 0 & J < 1000)
        		#local Pt = VRand_In_Box(Mn, Mx, RS);
        		#local J = J + 1;
    		#end
    	(Pt)
	#end
#end //if (MacroType = allInside || MacroType = rodOutsideRandInside)

#if (MacroType = allInside )
	 #debug "\nRod inside"
	#macro Rods()
	#ifndef(Box)	
		#declare Box =
		box {
  			<-10, 0, -10>,<10, 0.2, 10>
  			translate 10*y
		}
		#declare Rand = seed(1101);
	#end //#ifndef(Box)

	#declare Norm  = <0, 0, 0>;
	#declare Start = VRand_In_Obj(Box, Rand);
	#declare Pos   = trace (Surface, Start, -y, Norm);   

	#declare Cyl =
	cylinder {
 		 0, <0,1,0>, 0.05
 		 scale <1, RRand(0.5, 1.5, Rand), 1>
  		translate Pos
  		pigment {srgb <RRand(0.1, 0.9, Rand), RRand(0.1, 0.9, Rand), 
RRand(0.1, 0.9, Rand)>}
	}
	#end //	#macro Rods()
#end //#if (MacroType = allInside || MacroType = allOutside)

#if (MacroType = allOutside   | MacroType = rodOutsideRandInside)
	#include "rods.inc"
#end

global_settings {
  assumed_gamma 1.0
}

// ----------------------------------------

camera {
  location  <0.0, 5, -40.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 srgb <0.6,0.7,1.0>*1.3]
      [0.7 srgb <0.0,0.1,0.8>*1.3]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-3, 3, -3>*1000
}

// ----------------------------------------

#declare Surface =
plane {
  y, 0
  pigment { color srgb <0.7, 0.5, 0.3> }
}

object {Surface}



#declare I=0;

#for (I, 0, 1000000)
Rods()
object {Cyl}

#if (mod(I,10000) = 0)    
  #debug concat("\nRods: ", str(I,4,0)) 
#end 
#end



----------------------------------------------------------------------------------------------------------------------


//File: rods.inc

#if (MacroType = allOutside)
	 #debug "\nRand outside"

	#macro VRand_In_Box(Mn, Mx, RS) (< rand(RS), rand(RS), 
rand(RS)>*(Mx-Mn) + Mn) #end
	#macro RRand(Min, Max, RS) (rand(RS)*(Max-Min) + Min) #end
	#macro VRand_In_Obj(Obj, RS)
	    #local Mn = min_extent(Obj);
	    #local Mx = max_extent(Obj);
	    #local Pt = VRand_In_Box(Mn, Mx, RS);
	    #local J = 0;
	    #while(inside(Obj, Pt) = 0 & J < 1000)
	        #local Pt = VRand_In_Box(Mn, Mx, RS);
	        #local J = J + 1;
	    #end
	    (Pt)
	#end //#macro VRand_In_Obj(Obj, RS)
#end //#if (MacroType = allOutside)

#if (MacroType = allOutside | (MacroType = rodOutsideRandInside))
	 #debug "\nRod outside"
	#macro Rods()
		#ifndef(Box)
		#declare Box =
		box {
		  <-10, 0, -10>,<10, 0.2, 10>
		  translate 10*y
		}
		#declare Rand = seed(1101);
		#end
		
		#declare Norm  = <0, 0, 0>;
		#declare Start = VRand_In_Obj(Box, Rand);
		#declare Pos   = trace (Surface, Start, -y, Norm);   
		
		#declare Cyl =
		cylinder {
		  0, <0,1,0>, 0.05
		  scale <1, RRand(0.5, 1.5, Rand), 1>
		  translate Pos
		  pigment {srgb <RRand(0.1, 0.9, Rand), RRand(0.1, 0.9, Rand), 
RRand(0.1, 0.9, Rand)>}
		}
	#end	
#end
-- 
-------------------------------------------------------------------------------------------


POV-Ray 3.7 unofficial: http://megapov.inetart.net/povrayunofficial_mac/
UberPOV Mac: http://megapov.inetart.net/uberpov_mac/index.html#Mac
MegaPOV: http://megapov.inetart.net
E-mail: yvo(DOT)s(AT)gmx.net


Post a reply to this message


Attachments:
Download 'iso-8859-1' (17 KB)

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.