473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

opinions comments needed for improving a simple template engine.

Hi, I wrote a small template engine called spytee.
Like any template enigne, it take a text(html) template file as input,
process the variable tags in the file, and display the resulted text.
The difference from most templates are: you can edit the template file
in the html editor(Frontpage, Dreamweaver, whatever), thus a near
Complete seperation of presentation and logic. It's very simple and
easy, you only need 3 types of tags to control display, I don't think
most controls like 'if' 'else' 'loop', should be in a template anyway.

It also compile the template input into a python program and store it
in the cache location if the template is newer. On the next request of
displaying the same file, it will execute the cached python program to
save time.

the download is www.pytan.com/download/spytee.tar.gz
(there are 2 files: spytee.py and a sample template html file, just
unzip/untar it to a directoy and excute it to see how it work)

I borrowed some code from phpbb template( which in turn borrowed from
Phplib template and smarty template)

I'm new to Python (used perl and php a lot), so I'l need your help on
improving the speed of this thing.
I only tested it on mod_python, it's faster than PyMeld and Tinpy.
However it's slower than mod_python PSP, especially when excuting large
loops, like displaying a 1000 row table. (I didn't test large ones like
cheetah, quixote etc.)
At first I thought it was regular expression that slow it down. But
after I get rid of re, I didn't see much improvement.
Pleasa try it, and any feedbacks is appreciated.

Jul 18 '05 #1
1 1587
the ONLY way to tell what is slow is to actually profile each of the
operations, that said, start with examining object creation / memory
allocation. string concationation usually does both . . .

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Alex | last post by:
Hi all, We're looking at a vendor who uses the InterSystems Cache Database Platform, but our IT department has zero experience with this system. This software package will have a pivotal and...
16
by: Andy Dingley | last post by:
I've just had a call from these people, http://www.browsealoud.com offering to sell me their wares. Anyone have an opinion on it ? I'll post my own thoughts about 24 hours from now. I'm...
38
by: | last post by:
I have a script... ----- <SCRIPT language="JavaScript" type="text/javascript"> <!-- function makeArray() { for (i = 0; i<makeArray.arguments.length; i++) this = makeArray.arguments; } ...
35
by: R. Rajesh Jeba Anbiah | last post by:
Nowadays in PHP world, the "noise" is about upcoming PHP6 <http://phplens.com/phpeverywhere/?q=node/view/212> <http://www.planet-php.net/>. Do c.l.php readers have any comments or suggestions? ...
1
by: Robert J. Hansen | last post by:
I'm exploring the use of type traits (which, I hasten to say, I've hardly ever used before) as a way to help simplify some complex special-case logic in an existing codebase. I'm finding that I'm...
9
by: Arnold | last post by:
I need to read a binary file and store it into a buffer in memory (system has large amount of RAM, 2GB+) then pass it to a function. The function accepts input as 32 bit unsigned longs (DWORD). I...
9
by: SQLScott | last post by:
I have always heard that using IIF statements is not recommended because they are slower than using If..Then statements, and not as "clean". I would appreciate others opinions and why/why not use...
5
by: prakash.mirji | last post by:
I am using evaluation copy of RW 9.0 for porting one of C++ application on RHEL4 (x86 platform). We are getting some issues into RW template classes. Please need assistance on this issue. Here...
17
by: allen.fowler | last post by:
Hello, Can anyone recommend a simple python template engine for generating HTML that relies only on the Pyhon Core modules? No need for caching, template compilation, etc. Speed is not a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.