Showing posts with label framework. Show all posts
Showing posts with label framework. Show all posts

2020-05-29

Techempower Framework Benchmark Round 19

The result for Techempower framework benchmark round 19 is out, as usual the most important benchmark is the update and multi query benchmark:


This time, C++ (drogon), Rust (actix) are the top tier performer, followed by Java, Javascript (vertx's es4x), PHP (kumbiaphp+workerman), C# (ASP.NET), C (h2o), Kotlin (kooby), Scala (vertx), Go (fasthttp) and C#.



The top performer for multi-query benchmark are: C++, Rust, Java, Scala, JS, Kotlin, PHP, and Go. It's interesting to see that VLang already entered this benchmark but only on plaintext and json serialization benchmark. Compared to previous benchmark, Scala is in, Python, Perl, and Dart are out of the screenshoted top tier for now.

2019-12-20

State of Svelte UI Libraries

Awesome list of Svelte component libraries, which is CSS Framework that have Svelte integration. Here's the comparison among them all:

Component SvelteStrap 3.2.8 Svelma Bulma Components Svelte-MUI Svelte-Chota Smelte
Based on https://getbootstrap.com/ https://bulma.io/ https://bulma.io/ https://material.io/ https://jenil.github.io/chota/ https://material.io/
URL https://bestguy.github.io/sveltestrap/ https://c0bra.github.io/svelma/install http://svelte-bulma-components.surge.sh/ https://svelte-mui.ibbf.ru/ https://alexxnb.github.io/svelte-chota/ https://smelte.netlify.com/
Layout Container, Row, Col div.tile

Container, Row, Col
Alert/Flash/Toast Alert, Toast Message, Notification, Snackbar.(), Toast.()
Snackbar
Snackbar
Breadcrumb Breadcrumb




Buttons Button

Button, ButtonGroup Button Button
Card Card article.media

Card Card
Animation Collapse, Fade Collapse
Ripple Details
Dropdown Dropdown
Dropdown

Select
Forms Form, FormGroup, Label, Input Field, Input, Switch
CheckBox, Datepicker, Datefield, Textfield, Radio Input, Field, Radio, Checkbox TextField, SearchBar
Jumbotron/Hero Jumbotron section.hero



List ListGroup



List
Modal/Dialog Modal Dialog.(), Modal Modal Dialog Modal Dialog
Nav/Tabs/Pills/Acordion Nav Tabs TabsContainer ExpansionPanel, Menu Nav, Tabs Tabs, Menu
NavBar with Mobile NavBar
Navbar Sidepanel
NavigationDrawer
Pagination Pagination
Pagination


Progress Progress, Spinner Progress


PorgressLinear, ProgressCircular
Table Table table.table


DataTable
Icon
Icon .fa Icon icon*=mdi*, Icon
Tag/Label



Tag Chip
Media Media



Image
Tooltip




Tooltip
Treeview




Treeview


There's also many CSS Framework that doesn't use Javascript such as: TentCSS, Milligram, Mustard, MiniCSS, Bulma, and Chota (on the table).

Update 2020: there's SvelteMaterialUI and IBM Carbon Svelte

Update 2021: Svelte Materialify

2019-07-25

Techempower Framework Benchmark Round 18

Framework Benchmark 18 is out (half year after previous result), the shocking result that Vert.x version of Javascript just killing almost everyone except Rust. Top performing programming languages for updating-database benchmark are: Rust, Java, Javascript, C++, C#, Go, Kotlin, Dart, Python.

For multiple-queries benchmark, the top performers are: Rust, Java, Javascript, C, Kotlin, C++, Clojure, Go, PHP, Perl, C#.

Rust is quite interesting, the only drawback that I found other than the syntax is the slow compile, it took nearly 6 seconds for even a minor changes (with Actix framework) in ramdisk to recompile, even with slow compile flags turned off.

2018-02-15

TechEmpower Framework Benchmark Round 15

As usual, the only one matters are data updates and multiple queries.

Top ranker languages are C, C++, Java, C#, Dart, Python, Go, Perl, Scala, Javascript.


Top ranker language for multiple queries: Dart, Java, C++, C, Kotlin, Rust, Ur, Go.

Dart seems to be getting more and more popularity, since a framework for cross platform mobile app: Flutter is very usable.

2017-05-11

TechEmpower Framework Benchmark Round 14

New benchmark result is out, as usual the important part is the data-update benchmark:


At that chart, the top ranking language are: Kotlin, C, Java, C++, Go, Perl, Javascript, Scala, C#; and for the database: MySQL, PostgreSQL, MongoDB.

Also the other benchmark that reflect real world case is multiple-queries:
On that benchmmark, the top performer programming language are: Dart, C++, Java, C, Go, Kotlin, Javascript, Scala, Ruby, and Ur; and the database: MongoDB, PostgreSQL, MySQL. You can see the previous result here, and here.


2016-11-29

Sinatra-like Web Framework Benchmark

So today I come across some benchmark about sinatra-like web framework at 20 July 2016, it compares:



You can see the details here.

2016-11-16

Techempower Framework Benchmark Round 13

After long wait, the latest Techempower Framework Benchmark 13 is out! And just like previous one, Go's fasthttp really really fast. As usual the most important thing is data updates benchmark:


Top ranker in this part (more than 1024 req/s) are GoC++JavaJavascript (NodeJS)PerlC#, ElixirDartScalaPythonClojure, and Groovy (Actually PHP are there below the last one on the picture with 1018 req/s). And for the database part would be: PostgreSQL, MongoDB, and MySQL.

2016-11-02

Javascript Virtual DOM Framework Benchmark

Recently I found a framework benchmark for javascript (round4 2016-09-12), it shows a lot information. The fastest ranker are:

Framework Version Runtime Ratio (% slower than fastest) MB Start MB 1K rows
vanillajs
1 2.98 4.85
inferno 1.0.0-beta9 3 3.19 6.60
vanillajs-keyed
4 2.98 4.81
dio.js 3.0.5 4 3.19 7.09
domvm 2.0.0-beta 10 3.15 7.43
kivi 1.0.0-rc2 17 3.17 6.69

Also there are another benchmark (this have fewer framework, last result at this time):

Framework Init Time First Render Time Overall Time
kivi[adv] 1.0.0 2,185 25,795 527,703
Inferno 0.7.22 3,340 31,780 553,513
Imba 0.14.3 15,920 26,250 569,895
Bobril 4.38.0 3,430 26,255 682,847
Vidom 0.3.16 3,400 38,220 729,882
Maquette 2.3.3 1,955 27,410 733,165
Snabbdom 0.5.0 2,565 34,710 759,481
React 15.3.1 38,640 56,065 926,403
React-lite 0.15.6 6,345 40,725 1,105,627
Preact 5.4.0 2,550 53,585 1,150,506
Vanilla[innerHTML] 1.0.0 1,790 16,925 1,500,676
Deku 2.0.0-rc16 3,285 45,950 1,598,787
Mercury 14.1.0 2,840 41,325 2,115,253
yo-yo 1.2.2 1,825 21,835 2,295,505

Apparently there are a lot of them around the internet.
Of course you can build your own framework, here's the tips if you plan doing so.

2016-05-26

Iris Web Framework

Shock! That was what I feel when see Iris benchmark '__'), after looking at the code, ah no wonder, it uses fastest router (fasthttp), that uses almost zero allocation per request.

These graphs stolen from SmallNest's go framework benchmark.









As usual, static request means nothing, dynamic request that uses database are the real bottleneck :3
Btw Iris has book for those who are interested. For those who doesn't need full framework, you can use the fasthttprouter.

EDIT: before you use Iris because of performance, see links on the comments below: this by julienschmidt (one that create httprouter) and this by dlsniper (one that initialize go-lang-idea-plugin project).

 What's the alternative? you can use valyala's FastHttp (only router), Arteugo, or Fiber (full framework, really similar to ExpressJS)

2016-02-26

Techempower Framework Benchmark Round 12

After long wait, the latest Techempower Framework Benchmark 12 is out! And it's quite shocking that Go's fasthttp really really fast. As usual the most important thing is data updates:


Top ranker in this part (more than 2000 req/s) are Go, C++, Perl, Dart, Javascript (NodeJS), Clojure, Java, PHP (HHVM), Scala, Python, and Ruby.
Hopefully this library (fasthttp) could become the new standard implementation, maybe for Go 2.0? :3

2016-02-22

Gokil Golang Library (and Web Framework)

Gokil (Golang Keen for Improvement Library), is a library that I've been using for about 1.2 years. It was made based on httprouter and designed to have SnakeCase ruby-like functions. In Indonesian language "gokil" means insane, unpredictable, funny, or unique. To use this library, first you must have installed Go and configure GOPATH correctly, then fetch the library:

go get -u -v gitlab.com/kokizzu/gokil

There are six more program dependencies required:

# session, log multiplexer, binary compressor
sudo pacman -S redis unbuffer upx

# colorize compile output
go get -u -v github.com/kokizzu/colorgo

# auto-compile and reload on code changes, 
# please use go 1.4 since 1.5+ has slower compile speed
go get -u -v github.com/kokizzu/gin

# binary compressor for deployment
go get -u -v github.com/pwaller/goupx

If your connection is too slow, you can download the dependency files (and all example codes below) here (extract the content to GOPATH/src), don't forget to update to latest version using command above.

So, what's all about with this library?
First, it splitted into few directory:
  • A for Array
  • B for Boolean
  • C for Character
  • D for Database
  • F for Floating-point
  • I for Integer
  • J for JSON
  • K for anything else
  • L for Logging
  • M for Map
  • S for String
  • T for Time
  • W for Web (framework)
  • X for any type
  • Z for template engine
How to use the library, just like a normal library, you can include and then use them:

package main
import (
  `gitlab.com/kokizzu/gokil/S`
  `gitlab.com/kokizzu/gokil/L`
)

func main() {
  x := `12345678`
  L.Print(`x in int64: `, S.ToI(x) )
}

Program above will show an output:

2016-02-22 12:40:31.376 Print ▶ o:8: 
x in int64:  12345678

If you want to use the web framework, you can prepare these directories within your project folder (in this example, the project name is "PresFIS"):
  • ajax (to handle all HTTP POST request)
  • model (to do any kind of database query)
  • page (to handle all HTTP GET request)
  • views (the template for rendering)
  • public (the public/asset resource)
  • logs (log files)
mkdir $GOPATH/PresFIS
cd $GOPATH/PresFIS
mkdir -p ajax model page views public/js public/css logs

Create the .gitignore file:

echo 'logs
public/css/all.css
public/js/all.js
public/css/lib.css
public/js/lib.js
gin-bin
.idea' > .gitignore

Create a assets.go file, the files included here should be put in the public/ directory, named main.js and js/jquery.js. If you want the source to be outside the js/ or css/ folder, just add a slash prefix. These files will be minified into two files lib.js and all.js on production (this also works for css files). Of course you can skip this part and include the javascript or css files directly on the views if you do not want the code to be minified.


Create a page/public.go, I usually make first segment of the url to be the file name, so it can be searched easily, it should contain something like this:


Create the views, in views/public/hello.htmlhey.html and home.html (on views/ folder) for example:



<a href="/public/hello">Hello</a>
<a href="/public/hey/1">Hey 1</a>
<a href="/public/hey/2">Hey 2</a>

There are 4 syntax for push template rendering that do exactly the same:
  • #{locals_key}
  • {/* locals_key */}
  • [/* locals_key */]
  • /*! locals_key */
each of them will print the locals_key if the key not found on the locals (second parameter of ctx.Render).

Create a views/layout.html file, that will be called wrapping the views being rendered, something like this:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>#{title} | #{project_name}</title>
</head>
<body style="width:100%; height: 100%; overflow-x: visible">
#{resources}
<noscript>
  Please enable Javascript or use Javascript-enabled browser.
</noscript>
<div id="wrapper" style="width:100%; height:100%; margin: 0 auto">
  #{contents}
</div>
</body>
</html>

Create an ajax handler ajax/public.go, with the same rule as the the page:


Create a router.go file, the file should contain handlers, for example:


Create error views 403.html404.html, 500.html,:503.html, and error.html

<h1><b>Error 403</b>: Forbidden</h1>
<h2>#{requested_path}</h2>
<br/>
<p>It's forbidden for you to access this page (insufficient privilege), either contact the #{webmaster} or
  try again. Use your browser's <b>Back</b> button to navigate to the page you have previously come from</p>
<p><b>Or you could just press this neat little button:</b></p>
<button class="btn btn-large btn-info" onclick="window.history.back()">
  <i class="glyphicon glyphicon-arrow-left"></i> Take Me Back
</button>
<button class="btn btn-large btn-info" onclick="window.location='/'">
  <i class="glyphicon glyphicon-home"></i> Take Me Home
</button>

<h1><b>Error 404</b>: Page Not Found</h1>
<h2>#{requested_path}</h2>
<img src="/img/404.jpg"/>
<br/>
<p>The page you requested could not be found, either contact the #{webmaster} or try again. Use your
  browser's <b>Back</b> button to navigate to the page you have previously come from</p>
<p><b>Or you could just press this neat little button:</b></p>
<button class="btn btn-large btn-info" onclick="window.history.back()">
  <i class="glyphicon glyphicon-arrow-left"></i> Take Me Back
</button>
<button class="btn btn-large btn-info" onclick="window.location='/'">
  <i class="glyphicon glyphicon-home"></i> Take Me Home
</button>

<h1><b>Error 500</b>: Internal Server Error</h1>
<h2>#{requested_path}</h2>
<img src="/img/500.jpg"/>
<br/>
<p>There is a possible programming mistake on this page, either contact the #{webmaster} or try again. Use
  your browser's <b>Back</b> button to navigate to the page you have previously come from</p>
<p><b>Or you could just press this neat little button:</b></p>
<button class="btn btn-large btn-info" onclick="window.history.back()">
  <i class="glyphicon glyphicon-arrow-left"></i> Take Me Back
</button>
<button class="btn btn-large btn-info" onclick="window.location='/'">
  <i class="glyphicon glyphicon-home"></i> Take Me Home
</button>

<h1><b>Error 503</b>: Server is Over Capacity</h1>
<h2>#{requested_path}</h2>
<img src="/img/503.jpg"/>
<br/>
<p>Server is over capacity, please wait 30 minutes then try again by clicking your browser's <b>Refresh</b>
  button (F5/Ctrl+R)</p>
<p><b>Or you could just press this neat little button:</b></p>
<button class="btn btn-large btn-info" onclick="window.location.reload()">
  <i class="glyphicon glyphicon-refresh"></i> Refresh
</button>
<button class="btn btn-large btn-info" onclick="window.history.back()">
  <i class="glyphicon glyphicon-arrow-left"></i> Take Me Back
</button>
<button class="btn btn-large btn-info" onclick="window.location='/'">
  <i class="glyphicon glyphicon-home"></i> Take Me Home
</button>

<h1><b>Error</b>: #{message}</h1>
<pre>#{detail}</pre>
<h2>#{requested_path}</h2>
<br/>
<p>Insufficient privilege or invalid parameter, either contact the #{webmaster} or try again. Use
  your browsers <b>Back</b> button to navigate to the page you have previously come from</p>
<p><b>Or you could just press this neat little button:</b></p>
<button class="btn btn-large btn-info" onclick="window.history.back()">
  <i class="glyphicon glyphicon-arrow-left"></i> Take Me Back
</button>
<button class="btn btn-large btn-info" onclick="window.location='/'">
  <i class="glyphicon glyphicon-home"></i> Take Me Home
</button>

Create the main server.go file to initialize the server:


The main function:


You could also add a filter (for example, checking session from ctx.Session), something like this:


Create the start_dev.sh (auto-reload), deploy_prod.sh (rsync to server) and run_production.sh (start the service on server) scripts:




After starting the start_dev.sh and visit http://127.0.0.1:3000/ logs like this will show up on the terminal:


The dots means an access to public/ directory, if you want to hide them, you can add an reverse proxy like nginx or caddy.

Here's the minimal project structure:

What about the model/ directory? You can create a global connection, initialize with init function, then create a query function that can be called within ajax/ or page/.

Bonus: pullpush.sh script..


That's all for now, you can contribute to this library by sending a pull request on gitlab.