plone / diazo

Diazo applies a static HTML theme to a dynamic website
http://diazo.org
Other
41 stars 26 forks source link

Escape curly brackets on theme attributes #22

Closed seocam closed 11 years ago

seocam commented 11 years ago

Replacing curly brackets by double curly brackets inside every theme attribute. Updates #21

seocam commented 11 years ago

I've checked the performance of that code running it on a theme with about 2500 nodes and 3 scenarios:

1- No replaces (control) 2- Every node had at least one opening and one closing bracket 3- 1% of the node had at least one opening and one closing bracket

Average time in each scenario:

1- 40.95 ms 2- 43.63 ms 3- 41.03 ms

The sample was collected running the same code 500 times and critical values (out of the standard deviation) were removed.

def normalize(data_set):
    data_set = map(float, data_set)
    std_dev = std(data_set)
    avg = mean(data_set)
    min = avg - std_dev
    max = avg + std_dev
    return [v for v in data_set if v >= min and v <= max]

Avg was calculated using the normalize data set calculated with the function above.

The whole point here is to show that this code won't affect much the performance of real case themes (less them 1% slower).

lrowe commented 11 years ago

Looks good. Would be great if you could add a test case. The diazo tests are just folders with theme, content, rules, output.

seocam commented 11 years ago

Hey @lrowe,

I've added the test.

The bootstrap.py script is broken so travis build will fail besides all tests are ok. I've updated the .travis.yml in order to make travis tests work again but in another branch. If you like I can pull request that change as well.

seocam commented 11 years ago

@lrowe, is there something else I can do here? :)

cheers!

seocam commented 11 years ago

Thanks dude!

seocam commented 10 years ago

@ericof are you going to release it any time soon?