• Home
  • Blog
  • About
  • Contact
  • Social
  • Affiliate ​Store
2BIT || ! 2BIT
  • Home
  • Blog
  • About
  • Contact
  • Social
  • Affiliate ​Store
2BIT || ! 2BIT

Performance of JVM vs native vs the world

2/15/2019
Picture
,Performance tests in several basic scenarios to estimate languages runtime performance

​Lately I was trying to understand how virtual memory works and how JVM work and perform.
My intuition was ' if a JVM is written in C, it is probably less performant than C '
So after a lot of reading and investigations I found out that the story is much more complicated then I have initially thought.
JVM has many optimization which makes it very fast most of the time, it does has an overhead but the optimization in JIT make every thing worth it.
basically the JVM will loaded into native virtual memory (and be shared with other processes when possible)
it will use sophisticated algorithms to allocate memory on the native heap to create managed heap.
it will JIT to perform well, will vectorise  actions and what not to make the run time overhead worth it.
At that point I was thinking ' OK, so javascript is a VM, it should probably also perform well '
But benchmark tests online showed different things. I know javascript is single threaded but this tests take this into account (For example fork many process).
The V8 engine is highly optimized and make all kind of clever things to perform faster, for example making a behind the scene classes and types and caches to speed up the execution.
V8 is still young compared to C and Java so I am sure it will be even better. my impression is that optimizing a dynamic language such as javascript is harder than a language like java, but I might be wrong here.

Any way I thought that I have to make my own test to better understand the performance difference in various situations, so here it is, my results
1. ​java and node win when performing loops and in memory

2. c and go win as of for reading file from disk to memory

3. java wins in http server
​hope you will find this info helpful!

Comments are more the welcome.
0 Comments

Android libraries - all the reading you need

1/3/2019
  • gradle
  • dependencies
  • libs
0 Comments

Hosting android libraries on github

1/3/2019
​What to host you android custom library on your own  public github account
(Remote binary dependency)
Let's start:
  • Start with this one
  • Continue with this
  • And here
  • And this
0 Comments

Vue.js + Vuex + Vuetify

1/3/2019
  1. Vuejs videos
  2. Vuex:  videos
  3. Vuetify videos
0 Comments

Kubernetes tutorial

1/3/2019
  1. Learn Kubernetes basic - best video ever
  2. See usage video 
  3. ​Install ​kubernetes
  4. Another good intro video
0 Comments

More (than 2) hardware interrupts for Arduino Uno (or nano)!

9/14/2018
when I was building my custom light 4 touch switch panel for my smartHomeDIY I discovered Arduino uno and nano has only 2 hardware interrupts, 
luckly,after searching for a while, I found a blog that helped me to overcome this limitation.
The solution is: pin change interrupts which are supported by the Arduino uno and nano: .

Regular hardware interrupts can be registered for raising or falling or change interrupt, but the pin change interrupts, as their name suggests, are only capable to deliver interrupts when the pin senses a voltage change in any direction, if you need to know which pin was changed you will have to read all pin states (or relevant pins) to know the new state and compare it to the old state (which you have to save on you program.
a small workaround in my case was to register for 2 hardware interrupts and for the other 2 required interrupts I used the pin chagne mechanism, but there are good news, the pin change interrupts are grouped into group of pins 
  • A0 to A5
  • D0 to D7
  • D8 to D13
So I just used different group for each switch and used a counter to ignore the second interrupt - leaving me with a raising interrupt.
Picture
To read more about this topic I recommend the following:
  1. The blog where I found the answer by brainy-bits
  2. The source project for the pin change lib
  3. Arduino documentation here and here and here
  4. And more info on stackexchange
  5. And on the Arduino form and on more here
  6. My open source implementation here
0 Comments

Debugging with colors and filters.

8/29/2018
When writing code and delivering to customers you usually will find your self (or someone else ...) debugging your code throw log files and probably a lot of them.
I know I do :)
​

Picture
So I wrote my self a small helper tool based on Electron and vue.js + vuetifyjs. which makes it cross-platform.
And I made is open source just for you :)

​Logx

You can just drag and drop you files on it and start 'finding' , setting colors for specific phrases or filtering in or out any phrase you like.
​Enjoy.

BTW I used this cool template code from github, to get started easily...

Just note that this is a work-in-progress, feel free to file in issue you find on github :)
0 Comments

Monitoring Azure DC/OS microservices on terminal

8/29/2018
Picture
If you like your realtime logs monitoring on terminal from anywhere while using your favourite searching and colouring tools like me, then you must read this.
Azure DC/OS is a great tool, but getting the logs from each microservice instance using the dashboard is slow and complected.
So for the rescue here comes dc/os CLI.
This command line utility will make you life much easier in just a couple of steps
  1. First ssh into your master dc/os node [help!]
  2. Install dc/os CLI like this.
  3. Then just type 'dcos task log <your-micro-service-name-here>  --follow'
    1. This will aggregate logs from all instances of this service.
  4. To see logs of the master just type 'dcos node log --leader --follow'
  5. To lean some more cool commands - read here. here and here

Good luck  and happy debugging ... :)
0 Comments

Starting embedded programming

2/5/2018
Subscribe to my YouTube channel
During my search to start and learn embedded system programming, I was not able to find a good reference to start with.
I was searching a reference that will easy me in into this topic.
Because this topic not only hard to learn it is also consists from several topics:
  • Hardware architecture
  • CPU architecture in my case ARM-Cortex
  • Hardware protocols and communications such as I2C or SPI
  • In Some cases analog electronics and digital basic electronics
  • And finally professional  c and c++ coding in relation to embedded hardware programming.

So after searching a lot and for a long time I came up with the following YouTube playlists and couple of links that will ease you into this very interesting field.
AliExpress.com Product - STM32F103C8T6 ARM STM32 Minimum System Development Board Module

​Embedded Step 1

​

​Embedded Step 2

​

communications

  1. Intro
  2. I2C,I2C
  3. SPI, SPI
  4. UART

Random important topics

  • Microcontroller (Arduino) TimersMicrocontroller (Arduino) Timers
  • Port Manipulation, Bit Math, Faster PWM/ADC
  • Analog-to-Digital Converter
  • PWM, And another one
  • Best 555 tutorial ever, 555 Timer
  • OpAmp (Operational Amplifier), Another one, And Another one, and this

Simple Electronics Basics

​
  • ​​Basic Electricity - What is an amp?
  • Basic Electricity - What is voltage?
  • Basic Electricity - Power and watts
  • Basic Electricity - Resistance and Ohm's law
  • All about batteries
  • Capacitors
  • Transistors
  • MOSFETS and BJTs
  • How does a Diode work
  • What is a schottky diode?
  • What is a zener diode?, And more
  • Inductor basics - What is an inductor?, And here, And here
  • Passive RC low pass filter
  • Passive RC high pass filter
  • Voltage divider​​
  • Comparator
  • How do antennas work​​

Tools

  • ​Oscilloscope tutorials
0 Comments

Debug I2C communication from MPU6050 to STM32F103C8T6 using Hantek 6022BE USB Oscilloscope

2/1/2018
Today I wanted to talk about a video that inspired me by Joop Brokking
it’s a tutorial video about STM32F103C8T6 ARM STM32 Minimum System Development board known also as the Blue Pill and how to program it to use the MPU-6050 sensors board via I2C
AliExpress.com Product - 1 pices STM32F103C8T6 ARM STM32 Minimum System Development Board Module For arduino Sensing Evaluation for Skiller
AliExpress.com Product - Free Shipping X 10PCS/LOT GY-521, MPU-6050 Module ,MPU6050 module ,3 Axis analog gyro sensors+ 3 Axis Accelerometer Module
In this video Joop tested the i2c communication from the MPU-6050 sensors board to the STM32F103C8T6 ARM-M3 Micro controller

He used a real hardware Oscilloscope to test the signal
and show the errors and how to fix them

These hardware Oscilloscopes are very useful
but could also be quite expensive, especially for a beginner

So I thought why not replicate the hardware setup and try the same experiment with my Hantek 6022BE PC USB Digital portable Oscilloscope
And see how the single looks like or if it’s even capable measuring these kind of signals
AliExpress.com Product - Hantek 6022BE PC USB Digital portable Oscilloscope Storage 2Channels 20MHz 48M Portable PC USB Oscilloscopes Handheld 6022BE
​The Hantek 6022BE PC USB Digital portable Oscilloscope, is a PC USB Digital portable Oscilloscope that features 2 20MHz analog Channels at 48M, and single can be shown on the computer with a dedicated software that comes with it
​
I have tested the 100KHz and 400KHz with no problem
You can see the clock signal and the data signal
As can be seen here it works great and it only costs around 70$
Picture
Picture
There are multiple ways to investigate the signal
and the software has some nice measuring capabilities

But of course it has less features than the hardware ones
and probably will not work at the higher scales of Mhz signals

I have also tried the same experiment with my USB 24MHz 8 Channel Logic Analyzer and the results were also great and this one only costs around 10$, but cannot debug analog signals only digital ones (i2c, spi, UART , etc...)
AliExpress.com Product - New USB Logic SCM 24MHz 8 Channel Logic Analyzer Debugger for ARM FPGA High Quality
Picture
To program the STM32 you will beed an FTDI programer connected to the STM32 B6 and B7
AliExpress.com Product - Free shipping 1pcs/lot New FT232RL FT232 USB TO TTL 5V 3.3V Download Cable To Serial Adapter Module For Ardui USB TO 232
Check out the full tutorial about programming the STM32F103C8T6 here
Picture
I2C test

0 Comments
Previous

    Categories

    All
    ARDUINO
    ELECTRONICS
    Embedded
    Raspberry Pi
    STM32F103C8T6
    TOOLS

    AliExpress.com Product - Free shipping! Microcontroller learning kit starter and proficient 24 interactive lessons for arduino

    Archives

    January 2019
    September 2018
    August 2018
    February 2018
    January 2018

    RSS Feed

    View my profile on LinkedIn

Do'nt forget

If you like what your read and it helped you trough the development and professional 
​growing 
​journey, please subscribe and share.

get in touch

    Subscribe Today!

Submit