You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ponymail.apache.org by Daniel Gruno <hu...@apache.org> on 2016/09/04 16:38:08 UTC

Some preliminary tests from the Coffee experiment

Hi folks,
As you can see from the flurry of commits, I've begun working my way
through rebuilding Pony mail from scratch with coffee and a new DOM
model. For now, the basic list view (compact mode) works, and the
results so far show a 70% decrease in processing time required to render
the list view compared to Pony Mail 0.9, which I find to be fantastic!

The list view and email view are being defined as classes instead of
functions now, so if anyone wishes to create a new list or email view
mode, they can simply inherit or extend those classes and modify them as
they see fit.

I am probably around 15% done with this build, so it's gonna take at
least a month or two to get somewhere useful, from a user perspective.

You can view the list view and scroll through it, use the left hand
calendar, but that's about it :D

Everything is being thoroughly commented on as I write it, so it should
be a lot easier to jump in and help out :)

With regards,
Daniel.

Re: Some preliminary tests from the Coffee experiment

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 05/09/2016 09:45, Daniel Gruno wrote:
> On 09/05/2016 09:32 AM, Francesco Chicchiricc� wrote:
>> On 04/09/2016 18:38, Daniel Gruno wrote:
>>> Hi folks,
>>> As you can see from the flurry of commits, I've begun working my way
>>> through rebuilding Pony mail from scratch with coffee and a new DOM
>>> model. For now, the basic list view (compact mode) works, and the
>>> results so far show a 70% decrease in processing time required to render
>>> the list view compared to Pony Mail 0.9, which I find to be fantastic!
>>>
>>> The list view and email view are being defined as classes instead of
>>> functions now, so if anyone wishes to create a new list or email view
>>> mode, they can simply inherit or extend those classes and modify them as
>>> they see fit.
>>>
>>> I am probably around 15% done with this build, so it's gonna take at
>>> least a month or two to get somewhere useful, from a user perspective.
>>>
>>> You can view the list view and scroll through it, use the left hand
>>> calendar, but that's about it :D
>>>
>>> Everything is being thoroughly commented on as I write it, so it should
>>> be a lot easier to jump in and help out :)
>> Not sure to grasp 100% of what you're doing but I've taken a look and
>> looks good (and cleaner): thanks!
>> Regards.
>>
> What I am doing is primarily three things:
>
> 1) Rewrite things, make it cleaner and more commented
> 2) Write it in CoffeeScript so it becomes less cluttered
> 3) Reform the way HTML was created using pure DOM controls now
>
> The 3rd thing is the main issue, and is why it's much faster.
> In the old days (0.9 and earlier), we would go in and make HTML on the
> fly using innerHTML, which is basically using JS to inject raw HTML into
> a page. This can be somewhat ugly, cluttered, dangerous and slow.
> Dangerous because you may not catch all the XSS stuff that could be
> injected (like if an email had a <script> in it), and slow because you
> are first writing HTML, then telling the browser to parse it and then
> turn it into objects with the DOM.
>
> To make a div in the old model, one would do:
> foo.innerHTML = "<div class='fooclass'>bla bla</div>"
>
> With the new model, one does:
> foo = new HTML('div', { class: 'fooclass' }, "bla bla")
> which directly talks to the DOM.
>
> There are many more advanced examples inside the code that really shows
> how this new HTML class works and excels.
>
> I should mention, that...4thly(?) all email list views and email
> displays are now classes. before, if you had to make a new view mode,
> you would copy all the functions, rename the new ones and somehow inject
> them into the script. With the new model, one would do...
>
> ### Create MyListView as an extension of BasicListView: ###
> class MyListView extends BasicListView
>     ### Redesign the scroll() function: ###
>     scroll: (@rpp, @pos) ->
>        some_new_way_of_displaying_email()
>
> ### Register the new mode in the registry ###
> ponymail_listview_methods_register(MyListView, 'my listview mode')
>
> and you would have your new copy, already with the old stuff inherited.
>
>
> Hope this helps :)

It does, indeed!

Thanks for explanations.
Regards.

-- 
Francesco Chicchiricc�

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
CXF Committer, OpenJPA Committer, PonyMail PPMC
http://home.apache.org/~ilgrosso/


Re: Some preliminary tests from the Coffee experiment

Posted by Daniel Gruno <hu...@apache.org>.
On 09/05/2016 09:32 AM, Francesco Chicchiricc� wrote:
> On 04/09/2016 18:38, Daniel Gruno wrote:
>> Hi folks,
>> As you can see from the flurry of commits, I've begun working my way
>> through rebuilding Pony mail from scratch with coffee and a new DOM
>> model. For now, the basic list view (compact mode) works, and the
>> results so far show a 70% decrease in processing time required to render
>> the list view compared to Pony Mail 0.9, which I find to be fantastic!
>>
>> The list view and email view are being defined as classes instead of
>> functions now, so if anyone wishes to create a new list or email view
>> mode, they can simply inherit or extend those classes and modify them as
>> they see fit.
>>
>> I am probably around 15% done with this build, so it's gonna take at
>> least a month or two to get somewhere useful, from a user perspective.
>>
>> You can view the list view and scroll through it, use the left hand
>> calendar, but that's about it :D
>>
>> Everything is being thoroughly commented on as I write it, so it should
>> be a lot easier to jump in and help out :)
> 
> Not sure to grasp 100% of what you're doing but I've taken a look and
> looks good (and cleaner): thanks!
> Regards.
> 

What I am doing is primarily three things:

1) Rewrite things, make it cleaner and more commented
2) Write it in CoffeeScript so it becomes less cluttered
3) Reform the way HTML was created using pure DOM controls now

The 3rd thing is the main issue, and is why it's much faster.
In the old days (0.9 and earlier), we would go in and make HTML on the
fly using innerHTML, which is basically using JS to inject raw HTML into
a page. This can be somewhat ugly, cluttered, dangerous and slow.
Dangerous because you may not catch all the XSS stuff that could be
injected (like if an email had a <script> in it), and slow because you
are first writing HTML, then telling the browser to parse it and then
turn it into objects with the DOM.

To make a div in the old model, one would do:
foo.innerHTML = "<div class='fooclass'>bla bla</div>"

With the new model, one does:
foo = new HTML('div', { class: 'fooclass' }, "bla bla")
which directly talks to the DOM.

There are many more advanced examples inside the code that really shows
how this new HTML class works and excels.

I should mention, that...4thly(?) all email list views and email
displays are now classes. before, if you had to make a new view mode,
you would copy all the functions, rename the new ones and somehow inject
them into the script. With the new model, one would do...

### Create MyListView as an extension of BasicListView: ###
class MyListView extends BasicListView
   ### Redesign the scroll() function: ###
   scroll: (@rpp, @pos) ->
      some_new_way_of_displaying_email()

### Register the new mode in the registry ###
ponymail_listview_methods_register(MyListView, 'my listview mode')

and you would have your new copy, already with the old stuff inherited.


Hope this helps :)

With regards,
Daniel.

Re: Some preliminary tests from the Coffee experiment

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 04/09/2016 18:38, Daniel Gruno wrote:
> Hi folks,
> As you can see from the flurry of commits, I've begun working my way
> through rebuilding Pony mail from scratch with coffee and a new DOM
> model. For now, the basic list view (compact mode) works, and the
> results so far show a 70% decrease in processing time required to render
> the list view compared to Pony Mail 0.9, which I find to be fantastic!
>
> The list view and email view are being defined as classes instead of
> functions now, so if anyone wishes to create a new list or email view
> mode, they can simply inherit or extend those classes and modify them as
> they see fit.
>
> I am probably around 15% done with this build, so it's gonna take at
> least a month or two to get somewhere useful, from a user perspective.
>
> You can view the list view and scroll through it, use the left hand
> calendar, but that's about it :D
>
> Everything is being thoroughly commented on as I write it, so it should
> be a lot easier to jump in and help out :)

Not sure to grasp 100% of what you're doing but I've taken a look and 
looks good (and cleaner): thanks!
Regards.

-- 
Francesco Chicchiricc�

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
CXF Committer, OpenJPA Committer, PonyMail PPMC
http://home.apache.org/~ilgrosso/