'2016/04'에 해당되는 글 2건

  1. 2016.04.29 버벌진트X양다일 "오늘 쓱" 음원 공개 & 가사 2
  2. 2016.04.22 SpareArray vs HashMap
2016. 4. 29. 13:23








브랜뉴 뮤직의 유명한 버벌진트와 R&B 보컬리스트 양다일의 콜라보 프로젝트를 진행 했습니다.



노래제목은 "오늘 쓱



 두분 모두 브랜뉴뮤직 소속 입니다.



쇼미더머니라는 Mnet 힙합프로그램에서 프로듀서를 맡으면 더 유명해지신 버벌진트.




양다일은 다른 아티스트나 피처링으로 많은 인기를 얻었고, 



2015년 10월에 널이라는 곡으로 첫 싱글 앨범을 출시 했습니다.









 "오늘 쓱" 



그냥 쓱 알아주길 바라는 나
그리고 자꾸 모른 척하고 있는 너
이제 시간이 된 듯해
나 오늘 말할래 네게
만날래 우리? 진지하게
(what would you say)

listen, 지금 나의 눈빛은
누구에게도 보여준 적 없어
오 어쩌면 나의 몸짓이
초조해보일지도 몰라, 널 더

깊이 알고 싶어, 가까이 가고 싶어
물론 자연스럽게 쓱-
알아줬으면 싶어, 내가 여지껏
내뱉은 단어들 속의 뜻

하지만 더 기다리다간 나
타이밍을 놓칠지 몰라 잠깐
가벼운 대화는 stop, 앉아봐
할 말이 있으니까 나 오늘 당장

그냥 쓱 알아주길 바라는 나
그리고 자꾸 모른 척하고 있는 너
이제 시간이 된 듯해 (time is now)
나 오늘 말할래 네게 (I'mma say it)
만날래 우리? 진지하게

'봄바람 휘날리며'
그 잘 나가는 노래와
같은 상황은 아니지만 너와 나

we got something going on, 
yeah 원래 다
시작이라는 건 이런 거 아냐?

'꽃송이가 꽃송이가'
이 설레는 느낌, that's all we got

that's all we got, that's all we got
들리니 나의 심장의 소리가

들리면 나에게 답을 줘 어떤 형태든
물론 존중해, 네가 내리는 선택은

오늘 안으로만 내게 전해줘
before the sunset, 해지기 전에

그냥 쓱 알아주길 바라는 나
그리고 자꾸 모른 척하고 있는 너
이제 시간이 된 듯해 (think it's time)
나 오늘 말할래 네게 (I'mma tell you)
만날래 우리? 진지하게 (what'd you say)

타이밍은 오늘 (today's the day)
지금 내 손을
잡아 줄 수 있겠니 
(could you hold my hand?)

girl, if you say no
I don't know what to do
(if you really say no,
I wouldn't know what to do)

오늘 쓱 알아주길 바라는 나 (you see me)
그리고 자꾸 모른 척하고 있는 너
이제 시간이 된 듯해
나 오늘 말할래 네게
만날래 우리? 진지하게
(now sing it 다일)

뚜루루 두룹뚜뚜
뚜루루 두룹뚜뚜
뚜루룹
뚜루루루루루





"오늘 쓱" 은 드라이브할 때 생각나는 노래네요.


왕 추천 !!  











Posted by hoonihoon
2016. 4. 22. 16:03

Sparse arrays can be used to replace hash maps when the key is a primitive type. There are some variants for different key/value type even though not all of them are publicly available.

Benefits are:

  • Allocation-free
  • No boxing

Drawbacks:

  • Generally slower, not indicated for large collections
  • They won't work in non-android project

HashMap can be replaced by the followings:

SparseArray          <Integer, Object>
SparseBooleanArray   <Integer, Boolean>
SparseIntArray       <Integer, Integer>
SparseLongArray      <Integer, Long>
LongSparseArray      <Long, Object>
LongSparseLongArray  <Long, Long>   //this is not a public class                                 
                                    //but can be copied from  Android source code 

In terms of memory here is an example of SparseIntArray vs HashMap for 1000 elements

SparseIntArray:

class SparseIntArray {
    int[] keys;
    int[] values;
    int size;
}

Class = 12 + 3 * 4 = 24 bytes
Array = 20 + 1000 * 4 = 4024 bytes
Total = 8,072 bytes

HashMap:

class HashMap<K, V> {
    Entry<K, V>[] table;
    Entry<K, V> forNull;
    int size;
    int modCount;
    int threshold;
    Set<K> keys
    Set<Entry<K, V>> entries;
    Collection<V> values;
}

Class = 12 + 8 * 4 = 48 bytes
Entry = 32 + 16 + 16 = 64 bytes
Array = 20 + 1000 * 64 = 64024 bytes
Total = 64,136 bytes

Source: Android Memories by Romain Guy from slide 90.

The numbers above are the amount of memory (in bytes) allocated on heap by JVM. They may vary depending on the specific JVM used.

java.lang.instrument package contains some helpful methods for advanced operation like checking the size of an object with getObjectSize(Object objectToSize).

Extra info are available from official Oracle documentation

Class = 12 byte + (n instance variables) * 4 byte
Array = 20 byte + (n elements) * (element size)
Entry = 32 byte + (1st element size) + (2ns elements size)




After some googling I try to add some information to the already posted anwers:

Isaac Taylor made a performance comparision for SparseArrays and Hashmaps. He states that

the Hashmap and the SparseArray are very similar for data structure sizes under 1,000

and

when the size has been increased to the 10,000 mark [...] the Hashmap has greater performance with adding objects, while the SparseArray has greater performance when retrieving objects. [...] At a size of 100,000 [...] the Hashmap loses performance very quickly

An comparision on Edgblog shows that a SparseArray need much less memory than a HashMap because of the smaller key (int vs Integer) and the fact that

a HashMap.Entry instance must keep track of the references for the key, the value and the next entry. Plus it also needs to store the hash of the entry as an int.

As a conclusion I would say that the difference could matter if you are going to store a lot of data in your Map. Otherwise, just ignore the warning.

Posted by hoonihoon