Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31515 > unrolled thread
| Started by | Kevin McMurtrie <mcmurtrie@pixelmemory.us> |
|---|---|
| First post | 2015-04-06 21:31 -0700 |
| Last post | 2015-04-08 22:22 -0700 |
| Articles | 5 — 2 participants |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Return of the Applets? Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2015-04-06 21:31 -0700
Re: Return of the Applets? Silvio <silvio@internet.com> - 2015-04-07 20:22 +0200
Re: Return of the Applets? Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2015-04-08 22:17 -0700
Re: Return of the Applets? Silvio <silvio@internet.com> - 2015-04-10 17:11 +0200
Re: Return of the Applets? Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2015-04-08 22:22 -0700
| From | Kevin McMurtrie <mcmurtrie@pixelmemory.us> |
|---|---|
| Date | 2015-04-06 21:31 -0700 |
| Subject | Re: Return of the Applets? |
| Message-ID | <mcmurtrie-EF858B.21310806042015@news.sonic.net> |
In article <Applets-20150405060326@ram.dialup.fu-berlin.de>, ram@zedat.fu-berlin.de (Stefan Ram) wrote: > Android apps are now running in the Chrome browser. What does > this remind me of? > > Let me remind you that Android apps are written in Java, > kind of, not Java SE, and, IIRC, not Java 8. But a kind of Java. > > Then, the browser must contain an emulator that runs Linux > where an app runs as a separate user with restricted rights > and within a sandbox. The security here might be better than > the security of the JVM, because the walls seem to be thicker. > > But the advantage of JavaScript is that it can interact with > a web page of flexible size, while both applets and apps run > in a rectangle of a fixed size, which does not blend in well > with responsive web design. Applets died because their API and packaging is a complete wreck. Plugin and Applet developers can only guess how it should work, and the guesses are notē compatible with each other. Applets still don't work - not even today. JavaScript does just about everything that Java Applets were meant to do. The only problems I've seen are that JS engines have no way of reliably optimizing arrays and there are no 64 bit numerics. It makes number and pixel crunching difficult. (Java sucks at arrays of objects but arrays of primitives work well.) -- I will not see posts from astraweb, theremailer, dizum, or google because they host Usenet flooders.
[toc] | [next] | [standalone]
| From | Silvio <silvio@internet.com> |
|---|---|
| Date | 2015-04-07 20:22 +0200 |
| Message-ID | <55242050$0$2821$e4fe514c@news2.news.xs4all.nl> |
| In reply to | #31515 |
On 04/07/2015 06:38 PM, Stefan Ram wrote: > Kevin McMurtrie <mcmurtrie@pixelmemory.us> writes: >> Applets died because their API and packaging is a complete wreck. > > Yet the quite recent Java EE 7 tutorial at Oracle says: > === > »1.3.2 Java EE Components« ... » > > The Java EE specification defines the following Java EE > components: > > · Application clients and applets are components that > run on the client. ======= > > · Java Servlet, JavaServer Faces, and JavaServer Pages > (JSP) technology components are web components that run > on the server. > > · EJB components (enterprise beans) are business > components that run on the server.« > >> number and pixel crunching difficult. (Java sucks at arrays of objects >> but arrays of primitives work well.) > > Really! Herb Sutter reported how someone just put all his > objects of the same class into a single array (for 3 key > classes) and his game ran 50 times faster (compared to > scattered heap allocation). > > Today, not only do we have cache, but we have prefetchers. > > Oracle could define an annotation for classes that means > that all objects of this class should reside within a > single array. > How does an array of objects help prevent scattered heap allocation?
[toc] | [prev] | [next] | [standalone]
| From | Kevin McMurtrie <mcmurtrie@pixelmemory.us> |
|---|---|
| Date | 2015-04-08 22:17 -0700 |
| Message-ID | <mcmurtrie-BF8419.22172308042015@news.sonic.net> |
| In reply to | #31526 |
In article <55242050$0$2821$e4fe514c@news2.news.xs4all.nl>,
Silvio <silvio@internet.com> wrote:
> On 04/07/2015 06:38 PM, Stefan Ram wrote:
> > Kevin McMurtrie <mcmurtrie@pixelmemory.us> writes:
> >> Applets died because their API and packaging is a complete wreck.
> >
> > Yet the quite recent Java EE 7 tutorial at Oracle says:
> > ===
> > ť1.3.2 Java EE ComponentsŤ ... ť
> >
> > The Java EE specification defines the following Java EE
> > components:
> >
> > ˇ Application clients and applets are components that
> > run on the client. =======
> >
> > ˇ Java Servlet, JavaServer Faces, and JavaServer Pages
> > (JSP) technology components are web components that run
> > on the server.
> >
> > ˇ EJB components (enterprise beans) are business
> > components that run on the server.Ť
> >
> >> number and pixel crunching difficult. (Java sucks at arrays of objects
> >> but arrays of primitives work well.)
> >
> > Really! Herb Sutter reported how someone just put all his
> > objects of the same class into a single array (for 3 key
> > classes) and his game ran 50 times faster (compared to
> > scattered heap allocation).
> >
> > Today, not only do we have cache, but we have prefetchers.
> >
> > Oracle could define an annotation for classes that means
> > that all objects of this class should reside within a
> > single array.
> >
>
> How does an array of objects help prevent scattered heap allocation?
The opposite.
Rather than creating an array of objects, it's turning each field of an
object into an array. Sadly, I've done this too.
------------
//Clean but extremely slow Java
class Pixel
{
byte r, g, b, a;
void setRGB (byte red, byte green, byte blue, byte alpha)
{
r = red;
g = green;
b = blue;
a = alpha;
}
}
Pixel bitmap[][] = new Pixel[1080][1920];
for (int y = 0; y < bitmap.length; ++y)
{
Pixel row[] = bitmap[y];
for (int x = 0; x < row.length; ++x)
{
Pixel p = new Pixel();
p.setRGB ((byte) x, (byte) y,
(byte) (x + y), (byte) 255); //Colors!
row[x] = p;
}
}
------------
//Fast Java but ugly
class Pixels
{
byte rgba[][][] = new byte[4][1080][1920];
void setRGB (byte red, byte green, byte blue,
byte alpha, int x, int y)
{
rgba[0][y][x] = red;
rgba[1][y][x] = green;
rgba[2][y][x] = blue;
rgba[3][y][x] = alpha;
}
}
Pixels bitmap = new Pixels();
for (int y = 0; y < 1080; ++y)
for (int x = 0; x < 1920; ++x)
bitmap.setRGB ((byte) x, (byte) y,
(byte) (x + y), (byte) 255, x, y); //Colors!
------------
// Very fast C++
struct Pixel
{
uint8_t r, g, b, a;
void setRGB (uint8_t red, uint8_t green,
uint8_t blue, uint8_t alpha)
{
r= red;
g= green;
b= blue;
a= alpha;
}
};
Pixel bitmap[1080][1920];
for (int y= 0; y < 1080; ++y)
for (int x= 0; x < 1920; ++x)
bitmap[y][x].setRGB(x, y, x+y, 255); //Colors!
--
I will not see posts from astraweb, theremailer, dizum, or google
because they host Usenet flooders.
[toc] | [prev] | [next] | [standalone]
| From | Silvio <silvio@internet.com> |
|---|---|
| Date | 2015-04-10 17:11 +0200 |
| Message-ID | <5527e836$0$2920$e4fe514c@news2.news.xs4all.nl> |
| In reply to | #31540 |
On 04/09/2015 07:17 AM, Kevin McMurtrie wrote:
> In article <55242050$0$2821$e4fe514c@news2.news.xs4all.nl>,
> Silvio <silvio@internet.com> wrote:
>
>> On 04/07/2015 06:38 PM, Stefan Ram wrote:
>>> Kevin McMurtrie <mcmurtrie@pixelmemory.us> writes:
>>>> Applets died because their API and packaging is a complete wreck.
>>>
>>> Yet the quite recent Java EE 7 tutorial at Oracle says:
>>> ===
>>> »1.3.2 Java EE Components« ... »
>>>
>>> The Java EE specification defines the following Java EE
>>> components:
>>>
>>> · Application clients and applets are components that
>>> run on the client. =======
>>>
>>> · Java Servlet, JavaServer Faces, and JavaServer Pages
>>> (JSP) technology components are web components that run
>>> on the server.
>>>
>>> · EJB components (enterprise beans) are business
>>> components that run on the server.«
>>>
>>>> number and pixel crunching difficult. (Java sucks at arrays of objects
>>>> but arrays of primitives work well.)
>>>
>>> Really! Herb Sutter reported how someone just put all his
>>> objects of the same class into a single array (for 3 key
>>> classes) and his game ran 50 times faster (compared to
>>> scattered heap allocation).
>>>
>>> Today, not only do we have cache, but we have prefetchers.
>>>
>>> Oracle could define an annotation for classes that means
>>> that all objects of this class should reside within a
>>> single array.
>>>
>>
>> How does an array of objects help prevent scattered heap allocation?
>
> The opposite.
>
> Rather than creating an array of objects, it's turning each field of an
> object into an array. Sadly, I've done this too.
>
> ------------
>
> //Clean but extremely slow Java
> class Pixel
> {
> byte r, g, b, a;
>
> void setRGB (byte red, byte green, byte blue, byte alpha)
> {
> r = red;
> g = green;
> b = blue;
> a = alpha;
> }
> }
>
> Pixel bitmap[][] = new Pixel[1080][1920];
> for (int y = 0; y < bitmap.length; ++y)
> {
> Pixel row[] = bitmap[y];
> for (int x = 0; x < row.length; ++x)
> {
> Pixel p = new Pixel();
> p.setRGB ((byte) x, (byte) y,
> (byte) (x + y), (byte) 255); //Colors!
> row[x] = p;
> }
> }
>
> ------------
>
> //Fast Java but ugly
> class Pixels
> {
> byte rgba[][][] = new byte[4][1080][1920];
>
> void setRGB (byte red, byte green, byte blue,
> byte alpha, int x, int y)
> {
> rgba[0][y][x] = red;
> rgba[1][y][x] = green;
> rgba[2][y][x] = blue;
> rgba[3][y][x] = alpha;
> }
> }
>
> Pixels bitmap = new Pixels();
> for (int y = 0; y < 1080; ++y)
> for (int x = 0; x < 1920; ++x)
> bitmap.setRGB ((byte) x, (byte) y,
> (byte) (x + y), (byte) 255, x, y); //Colors!
>
> ------------
>
> // Very fast C++
> struct Pixel
> {
> uint8_t r, g, b, a;
>
> void setRGB (uint8_t red, uint8_t green,
> uint8_t blue, uint8_t alpha)
> {
> r= red;
> g= green;
> b= blue;
> a= alpha;
> }
> };
>
>
> Pixel bitmap[1080][1920];
>
> for (int y= 0; y < 1080; ++y)
> for (int x= 0; x < 1920; ++x)
> bitmap[y][x].setRGB(x, y, x+y, 255); //Colors!
>
Of course, but I was not talking about an array of primitives.
[toc] | [prev] | [next] | [standalone]
| From | Kevin McMurtrie <mcmurtrie@pixelmemory.us> |
|---|---|
| Date | 2015-04-08 22:22 -0700 |
| Message-ID | <mcmurtrie-5C82C7.22220108042015@news.sonic.net> |
| In reply to | #31515 |
In article <applets-20150407183812@ram.dialup.fu-berlin.de>, ram@zedat.fu-berlin.de (Stefan Ram) wrote: > Kevin McMurtrie <mcmurtrie@pixelmemory.us> writes: > >Applets died because their API and packaging is a complete wreck. > > Yet the quite recent Java EE 7 tutorial at Oracle says: > === > ť1.3.2 Java EE ComponentsŤ ... ť > > The Java EE specification defines the following Java EE > components: > > ˇ Application clients and applets are components that > run on the client. ======= > > ˇ Java Servlet, JavaServer Faces, and JavaServer Pages > (JSP) technology components are web components that run > on the server. > > ˇ EJB components (enterprise beans) are business > components that run on the server.Ť GUI event handling may have been ironed out but there's currently a lot of FUBAR in applet security and signing. The way that Oracle patched up a lot of applet security holes results in signed JARs that might only be capable of running on a specific version of a JRE even when the bytecode is compatible. > >number and pixel crunching difficult. (Java sucks at arrays of objects > >but arrays of primitives work well.) > > Really! Herb Sutter reported how someone just put all his > objects of the same class into a single array (for 3 key > classes) and his game ran 50 times faster (compared to > scattered heap allocation). > > Today, not only do we have cache, but we have prefetchers. > > Oracle could define an annotation for classes that means > that all objects of this class should reside within a > single array. -- I will not see posts from astraweb, theremailer, dizum, or google because they host Usenet flooders.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web