[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #11563 [DocTor]: Improve consensus-health page by reducing size of HTML
#11563: Improve consensus-health page by reducing size of HTML
------------------------------+------------------------
Reporter: alphawolf | Owner: atagar
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: DocTor | Version:
Keywords: consensus-health | Actual Points:
Parent ID: | Points:
------------------------------+------------------------
'''Problem''':
The consensus-health page @ https://consensus-health.torproject.org/ is
currently ~ 5.4 MB uncompressed (231 KB over the wire, using gzip). The
large size of the uncompressed document makes browser rending take longer
than it needs to, consumes excess RAM, and (probably) consumes excess CPU
cycles on the server during compression, or excess bandwidth when served
uncompressed.
'''Specifics''':
1. Redundant content:
a. 25,862 instances of '<font color="blue">(.*?)</font>'
a. 5,068 instances of '<font color="gray"><s>(.*?)</s></font>'
a. 2,200 instances of '<font color="red">(.*?)</font>'
1. Unnecessary elements:
a. Headers in relay list use '<b>(.*?)<b/>' for bolding when changing
the '<td>' to '<th>' would give the same presentation for less bytes,
while being more semantically correct HTML. (8,256 instances)
a. Headers in relay list use '<br>' before each DirAuth name in order
to provide spacing (8,256 instances)
1. Unnecessary white space:
a. 572,662 instances of <space><space>
a. 97,899 instances of '\n' between (not inside) tags.
'''Proposal''':
Implement the following changes, which reduce the document size without
affecting its presentation:
1. Reduce redundant content:
a. Remove '<font color="blue"></font>' for each individual flag, and
set ' class="ic"' on the column instead. Add appropriate CSS.
'''Estimated savings: 600 KB'''
a. Replace '<font color="gray"><s></s></font>' with '<span
class="oic"><span>'. Add appropriate CSS. '''Estimated savings: 40 KB'''
a. Replace '<font color="red"></font>' with '<span
class="oiv"></span>'. Add appropriate CSS. '''Estimated savings: This
is actually a small net loss, but by changing <font> to <span> it will
match the other changes and compress more efficiently.'''
1. Remove unnecessary elements:
a. Remove all '<b></b>' and '<br>' tags from the relay list headers.
Set ' class="tbl-hdr"' on the <tr> and change '<td>' to '<th>'. Add
height and vertical alignment to CSS. '''Estimated savings: 77 KB'''
1. Remove unnecessary white space:
a. <space><space>
1. Replace each <space><space> with "\t". '''Estimated savings: 570
KB'''
1. OR: Remove all instances of <space><space> entirely.
'''Estimated savings: 1.1 MB'''
1. OR: Replace the white space with a variable that can be enabled
when white space is desired (for debuging purposes). ''' Estimated
savings: 1.1 MB'''
a. newline
1. Remove all newlines after block/table-related elements. '''
Estimated savings: 95 KB'''
1. OR: Replace newlines with variable that can be enabled for
debugging purposes. '''Estimated savings: 95 KB'''
By implementing the above changes, the consensus-relay could be trimmed by
up to 1.9 MB -- a full 1/3 of it's 5.4 MB bulk. Since part 3 could be
controversial, I'll put that in a separate patch (assuming it is wanted).
I'm attaching a patch that implements parts 1 and 2. It should trim the
uncompressed document by around 700 KB.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/11563>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs