Textpattern Forum

You are not logged in. Register | Login | Help

#21 2008-01-03 14:28:46

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 4,513
Website

Re: rvm_css (v1.0)

As I understand it, windows accepts both / and \ (but I can’t test in windows)
In TXP sometimes DS is used, sometimes a hardcoded / is used.

Offline

#22 2008-01-03 14:34:53

net-carver
Admin
From: UK
Registered: 2006-03-08
Posts: 1,648

Re: rvm_css (v1.0)

Ruud

As I understand it, windows accepts both / and \ (but I can’t test in windows)

Thank you.


Steve
Textile | My plugins on GitHub | @netcarver

Offline

#23 2008-01-03 15:32:44

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,108
Website

Re: rvm_css (v1.0)

Yes, Windows accepts both characters as an input path delimiter, but you should be extra careful if you process directory paths which were read as an OS output. It depends on the consistent use of DS in both path building and path processing code whether your code works cross platform.

Case in point is for instance here which didn’t work in Windows in its previous incarnation with hardcoded directory separators.

Offline

#24 2008-01-03 15:47:08

net-carver
Admin
From: UK
Registered: 2006-03-08
Posts: 1,648

Re: rvm_css (v1.0)

Ruud, Wet

Thank you both for answering my questions. I’ll be sticking with using the DS definition after reading your posts.

Ruud

Sorry if this seems to be hijacking your plugin thread but my question was honestly triggered by your code. I think in future I’ll start a new thread for any similar issues arising.


Steve
Textile | My plugins on GitHub | @netcarver

Offline

#25 2008-01-03 16:28:52

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: rvm_css (v1.0)

I’m not sure if I’m on the right tack here Steve but I think it depends on where you are within the “system” for example in my xamplite install I need to use C:\xampplite\htdocs\designer\files and something similar for the temp file path (also the path to textpattern in the config.php file) however all other links ie navigation etc are “/” which may be because they are within the PHP environment?? Anyway I have no problems with plug-ins.

Last edited by thebombsite (2008-01-03 16:31:55)


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#26 2008-01-03 16:48:38

net-carver
Admin
From: UK
Registered: 2006-03-08
Posts: 1,648

Re: rvm_css (v1.0)

Stuart

A little confusing. I’ll try to explain it…

URLs such as the navigation links will be ‘/’ as that’s what the URL spec says they need to be. However, file-path delimiters are different and controlled by the OS writers with no universal standard. On *nix the ‘/’ character is used and on Windows the ‘\’ character is the one used.

If I understand correctly, Wet was pointing out that whilst you can say to Windows “go to C:\My Documents” or “go to C:/My Documents” it will do so but when you ask “Where am I?” it will then say “C:\My Documents” — using the ‘\’ character.

Result, plugin writers who want cross-OS compatible plugins that deal with file-paths need to be careful to compare against the correct OS specific path delimiter when they get paths from the OS. That can easily be taken care of by using the DS definition instead of hard-coding ‘/’ or ‘\’ characters into the plugin.

Last edited by net-carver (2008-01-03 16:51:14)


Steve
Textile | My plugins on GitHub | @netcarver

Offline

#27 2008-01-03 17:11:24

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: rvm_css (v1.0)

Got it. :)


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#28 2008-01-03 22:55:39

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 739

Re: rvm_css (v1.0)

net-carver – not sure if this is relevant; but can confirm ruud’s plugin working on IIS server – and working great!!

Offline

#29 2008-01-06 01:39:01

hcgtv
Member
From: Charlotte, NC
Registered: 2005-11-29
Posts: 2,154
Website

Re: rvm_css (v1.0)

Ruud,

Just got a chance to try this out on a new site running r2762.

Decided to run Apache Bench: ab -c 5 -n 100 http://mysite.com

Without the plugin:
Concurrency Level: 5
Time taken for tests: 2.903062 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 326500 bytes
HTML transferred: 301600 bytes
Requests per second: 34.45 1 (mean)
Time per request: 145.153 [ms] (mean)
Time per request: 29.031 [ms] (mean, across all concurrent requests)
Transfer rate: 109.54 [Kbytes/sec] received

With the plugin:
Concurrency Level: 5
Time taken for tests: 3.412726 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 325800 bytes
HTML transferred: 300900 bytes
Requests per second: 29.30 1 (mean)
Time per request: 170.636 [ms] (mean)
Time per request: 34.127 [ms] (mean, across all concurrent requests)
Transfer rate: 93.18 [Kbytes/sec] received

Webserver specs:

  • Apache 2.2.6 – HTTP server
  • MySQL 5.0.51 – Database server
  • PHP 5.2.4 – Web scripting language
  • APC 3.0.16 – Alternative PHP Cache

This particular server is running the APC (opcode cache), since css.php is already cached, could having to go out to disk to retrieve the css file be slowing it down?


txp:tag – Textpattern Tags ~ TxPlanet – Textpattern Planet

Offline

#30 2008-01-06 09:04:46

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 4,513
Website

Re: rvm_css (v1.0)

Bert, try benchmarking the difference between loading css.php and the static stylesheet.css file instead. When using ‘ab’ as you are, it only benchmarks the loading of the main website HTML code, but not the loading of the style sheet.

For the main website, the difference for the normal website page in execution speed should be at most: 1 SQL query (retrieving the stylesheet name from the DB is not a complex query so it should be fast) and 1 filesystem call to check if the stylesheet file is present and can be read (the result should be cached by the filesystem).

When using an opcode cache I’m guessing the difference between css.php and a static style sheet is less, but the static file should still be a lot faster if you have enough RAM to cache, because then it will be cached by the OS in RAM.

Hmm… I’m wondering if you’d get a speed increase by putting the plugin code in the plugin_cache directory, because then APC can cache it. If it has to be loaded from the database and then eval-ed, I suspect APC can’t cache it. This is only the loading of the plugin I’m talking about here, btw, not the actual use of the plugin.

Offline

Board footer

Powered by FluxBB