Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 02-07-2024, 03:01 AM   #1
paperwhite13
Zealot
paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.
 
Posts: 129
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
Code bloat. What is it?

There was a stringent need for this topic, and now it exists.
paperwhite13 is offline   Reply With Quote
Old 02-07-2024, 04:18 AM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by paperwhite13 View Post
There was a stringent need for this topic, and now it exists.
Code bloat is extra code that doesn't need to exist in your eBook be it in the CSS or the HTML.

Here is an example of code bloat.
CSS
[code]p {
font-size: 1em;
text-align: justify;
text-indent: 1.2em;
}[quote]

The font-size and text-align do not need to exist. 1em is the default font size and a text-align of justify only needs to be in <body>.

Also, when you look at the CSS of most retail eBooks, you can have many CSS classes that do not do anything. That is code bloat.
JSWolf is offline   Reply With Quote
Advert
Old 02-07-2024, 04:51 AM   #3
paperwhite13
Zealot
paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.
 
Posts: 129
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
Quote:
Originally Posted by JSWolf View Post
text-indent: 1.2em;
Do you mean it doesn’t need to exist at all or should it be placed elsewhere?

Quote:
Originally Posted by JSWolf View Post
Also, when you look at the CSS of most retail eBooks, you can have many CSS classes that do not do anything. That is code bloat.
Do you have an example? (Not the code, but an actual, newer title from a major publisher, so we can look it up and inspect it ourselves.)
paperwhite13 is offline   Reply With Quote
Old 02-07-2024, 05:57 AM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by paperwhite13 View Post
Do you mean it doesn’t need to exist at all or should it be placed elsewhere?
The text-indent is the only code that's to be kept.


Quote:
Do you have an example? (Not the code, but an actual, newer title from a major publisher, so we can look it up and inspect it ourselves.)
As you can see, there is a lot of code bloat in the original CSS.

Here is the original CSS
Code:
img#cover_image:only-of-type { /*overrides the previous setting, but only in newer systems that support CSS3 */
    height: 99vh;
}
body.cover {
	margin-top: 0px;
	margin-left: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	text-align: center;
	background-color:#000000;
}
a{
	text-decoration: underline;
	display: inline;
}
div.cover {
	text-align: center;
}
/* added styles by EK*/
li {
	list-style-type:none;
}
p.TNI {
	font-size:0.92em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:justify;
	text-decoration:none;
	text-indent:0em;
}
p.LINESPACE {
	font-weight: normal;
	font-style: normal;
	font-size: 100%;
}
li.TOC {
	font-size:0.92em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
figure.IMG {
	display: block;
	margin-bottom: 1em;
	margin-top: 1em;
	text-indent: 0em;
	margin-right: 0em;
	margin-left: 0em;
	text-align: center;
}
img.img90 {
	width:90%;
}
img.img40 {
	width:40%;
}
body {
	line-height: 1.25;
}
p.ACH {
	font-size:1.333em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:1em;
	margin-left:0em;
	margin-right:0em;
	margin-top:5em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.ACL {
	font-size:0.833em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}

p.ACL2 {
	font-size:0.833em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0.8em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.ACUL {
	font-size:0.75em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0.50em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}

h1.CN {
	font-size:1.8em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:2em;
	margin-left:0em;
	margin-right:0em;
	margin-top:5em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.CO {
	font-size:0.917em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:120px;
	text-align:justify;
	text-decoration:none;
	text-indent:0em;
}
p.COMP {
	font-size:0.833em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:2.4em;
	margin-right:2.4em;
	margin-top:0em;
	text-align:left;
	text-decoration:none;
	text-indent:0.6em;
}
p.COMPF {
	font-size:0.833em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:2.4em;
	margin-right:2.4em;
	margin-top:16px;
	text-align:left;
	text-decoration:none;
	text-indent:0.6em;
}
p.COMPL {
	font-size:0.833em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:16px;
	margin-left:2.4em;
	margin-right:2.4em;
	margin-top:0em;
	text-align:left;
	text-decoration:none;
	text-indent:0.6em;
}
p.CRT {
	font-size:0.75em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:1em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.CUST {
	font-size:1.167em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:1em;
	margin-left:0em;
	margin-right:0em;
	margin-top:1em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.CUSTF {
	font-size:1.167em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:1.2em;
	margin-right:1.2em;
	margin-top:16px;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.CUSTL {
	font-size:1.167em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:16px;
	margin-left:1.2em;
	margin-right:1.2em;
	margin-top:0em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.DISP {
	font-size:0.917em;
	font-style:italic;
	font-weight:normal;
	margin-bottom:16px;
	margin-left:1.2em;
	margin-right:1.2em;
	margin-top:16px;
	text-align:left;
	text-decoration:none;
	text-indent:0em;
}
p.EPI {
	font-size:0.833em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.EPIF {
	font-size:0.917em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:7em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.EPISC {
	font-size:0.75em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.EX1 {
	font-family:serif;
	font-size:0.917em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:16px;
	margin-left:2.4em;
	margin-right:2.4em;
	margin-top:16px;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
p.SB1 {
	font-size:0.917em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:justify;
	text-decoration:none;
	text-indent:0em;
}
p.TMG {
	font-size:0.917em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:8px;
	margin-left:2.4em;
	margin-right:2.4em;
	margin-top:8px;
	text-align:left;
	text-decoration:none;
	text-indent:0em;
}
p.TMGF {
	font-size:0.917em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:8px;
	margin-left:2.4em;
	margin-right:2.4em;
	margin-top:8px;
	text-align:left;
	text-decoration:none;
	text-indent:0em;
}
p.TMGL {
	font-size:0.917em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:8px;
	margin-left:3.6em;
	margin-right:3.6em;
	margin-top:8px;
	text-align:left;
	text-decoration:none;
	text-indent:0em;
}
p.TX {
	font-size:0.917em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:justify;
	text-decoration:none;
	text-indent:1.2em;
}
span.eSANS_Arial_MT_Std_Regular_11 {
	font-style:normal;
	font-weight:normal;
}
span.eSANS_Bernhard_Modern_Std_Roman_11 {
	font-style:normal;
	font-weight:normal;
}
span.eSANS_Helvetica_Neue_LT_Std_55_Roman_SC_11 {
	font-family:serif;
	font-size:85%;
	font-style:normal;
	font-weight:normal;
}
p.ATA {
	font-size:0.917em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:justify;
	text-decoration:none;
	text-indent:0em;
}
h1.ATAH {
	font-size:1.5em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:2em;
	margin-left:0em;
	margin-right:0em;
	margin-top:5em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}
ul {
    padding-left: 0em;
    margin-left: 0em;
}
small {
    font-size: 85%;
}
blockquote {
    margin: 0em 0em 0em 0em;
}
sup {
    vertical-align: super;
    font-size: 0.65em;
    vertical-align: 35%;
}
sub {
    vertical-align: sub;
    font-size: 0.65em;
    vertical-align: -21%;
}
ol.toc {
    padding-top : 0em;
    padding-right: 0em;
    padding-bottom : 0em;
    padding-left : 0em;
    margin-top : 0em;
    margin-right : 0em;
    margin-bottom : 0em;
    margin-left : 0em;
    list-style-type : none;
}
hr.transition {
	background: url('../images/asterisks.jpg') no-repeat center;
	height: 1em;
	border: none;
	margin: 1em 0em 0.5em 0em;
}
ol.none
{
	list-style-type:none;
}

li.TOC-BOT {
	font-size:0.92em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:1em;
	margin-left:0em;
	margin-right:0em;
	margin-top:0em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}

h1.FMH {
	font-size:1.5em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:2em;
	margin-left:0em;
	margin-right:0em;
	margin-top:5em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}

p.ASCH {
	font-size:1.333em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:1em;
	margin-left:0em;
	margin-right:0em;
	margin-top:2em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}

p.CRT-TOP {
	font-size:0.75em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:5em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}

p.CRT1 {
	font-size:0.75em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:2em;
	margin-right:0em;
	margin-top:0em;
	text-align:left;
	text-decoration:none;
	text-indent:-1em;
}

p.CRT11 {
	font-size:0.75em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:2em;
	margin-right:0em;
	margin-top:1em;
	text-align:left;
	text-decoration:none;
	text-indent:-1em;
}

p.EPIFS {
	font-size:0.917em;
	font-style:normal;
	font-weight:normal;
	margin-bottom:0em;
	margin-left:0em;
	margin-right:0em;
	margin-top:1em;
	text-align:center;
	text-decoration:none;
	text-indent:0em;
}


p.fut_tit {
	display: block;
	text-align: center;
	text-indent: 0em;
	margin-top: 0em;
	margin-bottom: 0em;
	margin-left: 0em;
	margin-right: 0em;
}
p.fut_toc {
	font-weight: normal;
	font-style: normal;
	font-size: 0.90em;
	text-decoration: none;
	font-variant: normal;
	text-indent: 0em;
	text-align: center;
	margin: 0em 0em 0em 0em;
}
p.fut_toc1 {
	font-weight: normal;
	font-style: normal;
	font-size: 0.90em;
	text-decoration: none;
	font-variant: normal;
	text-indent: 0em;
	text-align: center;
	margin: 0em 0em 1.50em 0em;
}
p.fut_logo {
	font-weight: normal;
	font-style: normal;
	font-size: 1.31em;
	text-decoration: none;
	font-variant: normal;
	text-indent: 0em;
	text-align: center;
	margin: 1.20em 0em 1.20em 0em;
}


img.epub {
	display: inline;
	width: 7em;
}
img.epub1 {
	display: inline;
	width: 2.35em;
}

img.sign-up {
	display: none;
}
img.fb {
	display: none;
}
@media amzn-kf8 {
	img.epub {
		display: none;
	}
img.epub1 {
	display: none;
}
	img.sign-up {
		width: 3.5em;
		display: inline;
	}
	img.fb {
		width: 1em;
		display: inline;
	}
}
@media amzn-mobi {
	img.epub {
		display: none;
	}

img.epub1 {
	display: none;
}
	img.sign-up {
		width: 3.5em;
		display: inline;
	}
	img.fb {
		width: 1em;
		display: inline;
	}
	sup {
		vertical-align: super;
		font-size: 0.65em;
	}
	sub {
		vertical-align: sub;
		font-size: 0.65em;
	}
}
Here is the edited CSS
Code:
blockquote {
  margin-top: 0.8em;
  margin-right: 1.5em;
  margin-bottom: 0.8em;
  margin-left: 1.5em;
}
body {
  widows: 1;
  orphans: 1;
  margin-top: 0;
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 0;
  text-align: justify;
}
h2, .IMG {
  text-align: center;
  text-indent: 0;
  margin-top: 0.8em;
  margin-bottom: 0.8em;
}
hr {
  margin-top: 0.9em;
  margin-right: 40%;
  margin-bottom: 0.9em;
  margin-left: 40%;
  border-top: 2px solid;
}
img {
  max-height: 100%;
  max-width: 100%;
}
p {
  margin-top: 0;
  margin-bottom: 0;
  widows: 1;
  orphans: 1;
  text-indent: 1.2em;
}
.cover {
  text-align: center;
  text-indent: 0;
  height: 100%;
}
.smaller {
  font-size: 85%;
}
.TMG, .TMGL {
  font-family: sans-serif;
  margin-bottom: 8px;
  margin-top: 8px;
  text-indent: 0;
}
img.epub1 {
  display: inline;
  width: 2.35em;
}
img.fb {
  display: none;
}
img.img40 {
  width: 40%;
}
p.CO {
  text-indent: 0;
}
p.COMP {
  text-indent: 0.6em;
}
p.CRT {
  font-size: small;
  margin-top: 0.8em;
  text-align: center;
  text-indent: 0;
}
p.CRT1 {
  font-size: small;
  margin-left: 2em;
  text-indent: -1em;
}
p.CRT11 {
  font-size: small;
  margin-left: 2em;
  margin-top: 0.8em;
  text-indent: -1em;
}
p.CUST {
  font-size: 1.167em;
  text-align: center;
  text-indent: 0;
}
p.DISP {
  font-style: italic;
  text-indent: 0;
}
p.EPI {
  font-size: small;
  text-align: center;
  text-indent: 0;
}
p.EPIF {
  margin-top: 3em;
  text-align: center;
  text-indent: 0;
}
p.EPIFS {
  margin-top: 1em;
  text-align: center;
  text-indent: 0;
}
p.EPISC {
  font-size: 0.8333em;
  text-align: center;
  text-indent: 0;
}
p.EX1 {
  text-align: center;
  text-indent: 0;
}
p.fut_logo {
  text-indent: 0;
  text-align: center;
  margin-top: 0.8em;
}
JSWolf is offline   Reply With Quote
Old 02-07-2024, 06:24 AM   #5
paperwhite13
Zealot
paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.
 
Posts: 129
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
Quote:
Originally Posted by JSWolf View Post
The text-indent is the only code that's to be kept.

As you can see, there is a lot of code bloat in the original CSS.
What book is that from? What year was it published?
paperwhite13 is offline   Reply With Quote
Advert
Old 02-07-2024, 06:44 AM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by paperwhite13 View Post
What book is that from? What year was it published?
That is from Random in Death by J.D. Robb. It was released at the end of January 2024

I've seen eBooks where there are over 100 excess classes not used in the CSS.
JSWolf is offline   Reply With Quote
Old 02-07-2024, 08:19 AM   #7
paperwhite13
Zealot
paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.
 
Posts: 129
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
Got it, thank you. I see what you mean, but a lot of it is code bloat only if I put on my OCD hat (and I do have one). You even deleted comments In my other, non-OCD book code bloat is:

- code that slows down reading/loading in any perceptible, meaningful, quantifiable way;

- code that affects compatibility.

A lot of those are redundant, but does deleting/collapsing them have any meaningful impact? (And I don’t mean style-wise). Since they were most likely spit out automatically by InDesign, any time spent deleting comments for instance is production time bloat. I will always succumb to my OCD tendencies, but I don’t think anyone else who doesn’t is doing something wrong, unless the user experience is actually affected.
paperwhite13 is offline   Reply With Quote
Old 02-07-2024, 08:54 AM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by paperwhite13 View Post
Got it, thank you. I see what you mean, but a lot of it is code bloat only if I put on my OCD hat (and I do have one). You even deleted comments In my other, non-OCD book code bloat is:

- code that slows down reading/loading in any perceptible, meaningful, quantifiable way;

- code that affects compatibility.

A lot of those are redundant, but does deleting/collapsing them have any meaningful impact? (And I don’t mean style-wise). Since they were most likely spit out automatically by InDesign, any time spent deleting comments for instance is production time bloat. I will always succumb to my OCD tendencies, but I don’t think anyone else who doesn’t is doing something wrong, unless the user experience is actually affected.
I've yet to see CSS comments that are actually worth keeping. They aren't useful.

You definition of code bloat is not code bloat. It's bad code. Code Bloat is any code that's not needed to get the results you want. If the code is not needed. Empty <div>, <span> or <a> to show you where some pBook version page number is, a <div> to put space at the top of a chapter, ID's that don't do anything are all code bloat.

Even <p class="idontactuallyneedtobehere"> can be considered code bloat as all you need is <p>. But that's an ongoing debate. I think it's code bloat.
JSWolf is offline   Reply With Quote
Old 02-07-2024, 09:04 AM   #9
paperwhite13
Zealot
paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.
 
Posts: 129
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
Quote:
In computer programming, code bloat is the production of program code (source code or machine code) that is perceived as unnecessarily long, slow, or otherwise wasteful of resources
Your changes, besides recovering the tiny space occupied by the comments and other redundant declarations, do they speed up in any perceptible way navigation? Besides getting a different presentation that you find agreeable, what do you get from spending so much time tinkering with the CSS?

Last edited by paperwhite13; 02-07-2024 at 09:54 AM.
paperwhite13 is offline   Reply With Quote
Old 02-07-2024, 09:39 AM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by paperwhite13 View Post
Your changes, besides recovering the tiny space occupied by the comments and other redundant declarations, do they speed up in any perceptible way navigation? Besides getting a different presentation that you find agreeable, what do you get from spending so much time tinkering with the CSS?
In the editor it's very easy to remove the excess CSS. Then I sort the CSS. I remove any other CSS that I am going to be replacing. I then put in my CSS.

It doesn't take long to edit the code. Diap's Editing Toolbag, and S/R all help make it pretty quick. Editing the CSS is not difficult. That's actually pretty easy.

The rest depends on the HTML code. But again, not difficult.
JSWolf is offline   Reply With Quote
Old 02-07-2024, 09:54 AM   #11
paperwhite13
Zealot
paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.paperwhite13 can eat soup with a fork.
 
Posts: 129
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
I get that the code is better-looking, like I said, I find that appealing But does the epub load and/or navigate faster?
paperwhite13 is offline   Reply With Quote
Old 02-07-2024, 10:25 AM   #12
j.p.s
Grand Sorcerer
j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.
 
Posts: 5,285
Karma: 98804578
Join Date: Apr 2011
Device: pb360
Quote:
Originally Posted by JSWolf View Post
text-align of justify only needs to be in <body>.
It doesn't belong in <body> either. That should be left to user preference.
j.p.s is offline   Reply With Quote
Old 02-07-2024, 10:31 AM   #13
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,645
Karma: 5433388
Join Date: Nov 2009
Device: many
The answer is no, there is no appreciable code loading or execution differences 99% of the time.

And an epub publisher who uses a standard css across a number of books, is much more likely to make fewer errors of omission or design, thus improving quality.

JSWolf has simply overstated/over claimed things as usual. He makes unneeded changes for no valid reason other than he thinks it should be so and gets irrationally upset when explained otherwise.

Making code simpler when possible is always a good thing, but simplifying classes when css inheritance is in effect (and with some css injected by the reader) itself is fraught with errors and really is not a good idea.

Removing unused id attributes is another one of those short sighted mistakes people make as external cfi references by scholars and others into locations inside the epub, page boundaries, and etc are often lost or destroyed.

And as a practical rule, anything that does not significantly impact loading or execution speed should generally be left alone is probably a good idea.

What JSWolf does with his own books is up to him, but advocating his views to everyone else as a "law" is not. Simpler is better until it is not. Be careful making changes not fully understood. Adding or removing default css from a class can and does impact inheritance and can cause errors when reader injected css exists that needs to be overridden, etc.
KevinH is offline   Reply With Quote
Old 02-07-2024, 11:04 AM   #14
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,164
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
I did see one code bloat ebook recently. It had different spans that did not seem to do anything on every word!
Looked the same after removal (I was working on a copy too) and size changed from 2.5M to 0.6M, but that's very rare. Also I'm not sure it made discernable difference to reading the ebook. There were messed up chapter and section (Book 1 to Book 5) headings visible, which is why I opened and edited the ebook.

I forget the title, but I think it was from a small publisher and other titles from them were fine.

I do remove the penguins in chapter headings and some other pointless stuff from some books from the house of random penguins. It makes little difference to size or performance.

In general, real reflowable ebooks do not have code bloat of some programs, or some PDFs or some fixed layout electronic books (some are epub3 and some are really PDFs in an Amazon wrapper).

Quote:
Originally Posted by KevinH View Post
The answer is no, there is no appreciable code loading or execution differences 99% of the time.
On this occasion I'd agree with all KevinH is writing.

Quote:
Simpler is better until it is not. Be careful making changes not fully understood.
Absolutely.

Last edited by Quoth; 02-07-2024 at 11:11 AM.
Quoth is offline   Reply With Quote
Old 02-07-2024, 11:25 AM   #15
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by j.p.s View Post
It doesn't belong in <body> either. That should be left to user preference.
Text-align: justify;. It does belong in the <body>. It makes the eBook justified. Software that does not allow the alignment to be changed, it will be justified. Software that does allow the alignment to be changed, it will work. It works with my Libra 2 to change the alignment. But it can only be in <body> or it won't work.
JSWolf is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nook S2 vs regular S2--bloat vs bucks?? friedrice Which one should I buy? 5 05-05-2016 11:54 AM
After I Edit Code, Save, and Convert, all my Code Edits are Gone lukewrussell Calibre 1 03-14-2014 08:05 PM
Some code help Gray Eminence Sigil 3 12-31-2010 09:18 AM
code help AWOL Sigil 7 11-19-2010 11:50 AM
Let's create a source code repository for DR 800 related code? jraf iRex 3 03-11-2010 12:26 PM


All times are GMT -4. The time now is 10:01 AM.


MobileRead.com is a privately owned, operated and funded community.